Is string an Email address
import java.util.regex.Matcher; import java.util.regex.Pattern; class Main { public static final String EMAIL_PATTERN_STR = "^(.+)@(.+)$"; private static final Pattern EMAIL_PATTERN = Pattern .compile(EMAIL_PATTERN_STR); public static boolean isEmail(String text) { Matcher m = EMAIL_PATTERN.matcher(text); if (!m.find()) { return false; } else { return true; } } }