List of utility methods to do Email Validate
boolean | isValidEmailAddress(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(); |
boolean | isValidEmailAdress(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()); |
String | parseEmail(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; ... |
boolean | validateEmail(String email) validate Email return validatePattern(email, EMAIL_PATTERN);
|
boolean | validateEmail(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; |
Boolean | validateEmail(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; ... |
boolean | validateEmail(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); |
boolean | validateEmail(String email) Validates email pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(email);
return matcher.matches();
|
boolean | validateEmail(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; |
boolean | validateEmail(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; |