Java Utililty Methods Email Validate

List of utility methods to do Email Validate

  1. HOME
  2. Java
  3. E
  4. Email Validate

Description

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

Method

String baseAddress(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;
boolean checkEmail(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();
boolean checkEmail(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;
boolean checkEmail(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;
...
boolean checkEmail(String email)
check Email
String regex = "\\w+@\\w+\\.[a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)?";
return Pattern.matches(regex, email);
boolean checkEmail(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();
boolean checkEmailAddress(String address)
Check the given string to match the email format
Matcher m = PTN_EMAIL_ADDRESS.matcher(address);
return m.matches();
boolean checkEmailAddressNoEx(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];
...
boolean checkEmailPattern(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;
...
boolean checkEmailWithSuffix(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);


AltStyle によって変換されたページ (->オリジナル) /