Java Email Validate checkEmailPattern(String email)

Here you can find the source of checkEmailPattern(String email)

Description

check Email Pattern

License

Open Source License

Declaration

public static boolean checkEmailPattern(String email) 

Method Source Code

//package com.java2s;

import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Main {
    public static boolean checkEmailPattern(String email) {

        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();/*from  w  w  w.  ja  v  a  2  s .c  o  m*/

        return status;
    }
}

Related

  1. checkEmail(String email)
  2. checkEmail(String email)
  3. checkEmail(String mail)
  4. checkEmailAddress(String address)
  5. checkEmailAddressNoEx(String inEmailAddress)
  6. checkEmailWithSuffix(String email)
  7. cleanUpEmailAddress(CharSequence address)
  8. containsEmail(String chunk)
  9. extractEmail(String string, StringBuffer sb)