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

StringbaseAddress(String email)
Return the base address without the detail portion.
Matcher m = SUB_ADDRESS.matcher(email);
return m.matches() ? m.group(1) + m.group(2) : email;
booleancheckEmail(String email)
check Email
Pattern rfc2822 = Pattern.compile(
        "^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$");
return rfc2822.matcher(email).matches();
booleancheckEmail(String email)
Check email.
String ps = "^([\\w-\\.]+)@[\\w-.]+(\\.?[a-zA-Z]{2,4}$)";
Pattern p = Pattern.compile(ps);
Matcher m = p.matcher(email);
if (m.matches()) {
    return true;
} else {
    return false;
booleancheckEmail(String email)
check Email
boolean flag = false;
try {
    String check = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
    Pattern regex = Pattern.compile(check);
    Matcher matcher = regex.matcher(email);
    flag = matcher.matches();
} catch (Exception e) {
    flag = false;
...
booleancheckEmail(String email)
check Email
String regex = "\\w+@\\w+\\.[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)?";
return Pattern.matches(regex, email);
booleancheckEmail(String mail)
check Email
String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(mail);
return m.find();
booleancheckEmailAddress(String address)
Check the given string to match the email format
Matcher m = PTN_EMAIL_ADDRESS.matcher(address);
return m.matches();
booleancheckEmailAddressNoEx(String inEmailAddress)
check Email Address No Ex
boolean status = false;
String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(inEmailAddress);
status = m.find();
if (status == true) {
    String[] parts = inEmailAddress.split("@");
    String localPart = parts[0];
...
booleancheckEmailPattern(String email)
check Email Pattern
boolean status;
String emailPattern = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*";
emailPattern += "@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+";
emailPattern += "(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)";
Pattern p = Pattern.compile(emailPattern);
Matcher m = p.matcher(email);
status = m.matches();
return status;
...
booleancheckEmailWithSuffix(String email)
check Email With Suffix
String regex = "\\w+\\@\\w+\\.(com|cn|com.cn|net|org|gov|gov.cn|edu|edu.cn)";
return startCheck(regex, email);