Java Utililty Methods Email Validate

List of utility methods to do Email Validate

Description

The list of methods to do Email Validate are organized into topic(s).

Method

booleanisValidEmailAddress(String emailAddress)
is Valid Email Address
if (emailAddress == null) {
    return false;
String expression = "^[\\w\\-]([\\.\\w\\-])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(emailAddress);
return matcher.matches();
booleanisValidEmailAdress(String email)
returns true if the specified email is well formatted
return Pattern.matches("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)+$", email.toLowerCase());
StringparseEmail(String target)
Parse the target string, and check is obey the email format or not.
target = parseString(target);
if (target == null) {
    return null;
String regexp = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$";
Pattern pattern = Pattern.compile(regexp);
Matcher matcher = pattern.matcher(target);
return matcher.find() ? target : null;
...
booleanvalidateEmail(String email)
validate Email
return validatePattern(email, EMAIL_PATTERN);
booleanvalidateEmail(String email)
validate Email
boolean isValid = false;
Pattern emailPattern = Pattern.compile(EMAIL_PATTERN);
Matcher m = emailPattern.matcher(email);
if ((email.length() <= EMAIL_MAX_LENGTH) && (m.matches())) {
    isValid = true;
return isValid;
BooleanvalidateEmail(String email)
validate Email
String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
        + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
Pattern pattern;
Matcher matcher;
pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(email);
if (email == null || "".equals(email) || !matcher.matches()) {
    return false;
...
booleanvalidateEmail(String email)
Validates the syntax of the passed email.
String patternStr = "^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@"
        + "[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
return Pattern.matches(patternStr, email);
booleanvalidateEmail(String email)
Validates email
pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(email);
return matcher.matches();
booleanvalidateEmail(String email)
Validates an email address.
if (email != null) {
    Pattern pattern = Pattern.compile(
            "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
    return pattern.matcher(email).matches();
} else {
    return false;
booleanvalidateEmail(String email)
Checks if given email is valid by matching it to regex pattern.
final Pattern pattern = Pattern.compile("^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,4}$");
if (!pattern.matcher(email).matches()) {
    return false;
return true;