Java Email Validate isEmailValid(String email)

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

Description

Return true if Email has a valid format

License

Open Source License

Declaration

public static boolean isEmailValid(String email) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static final String REGEX_EMAIL = "^[\\w_.\\-]+@([a-zA-Z0-9_\\-]+?\\.){1,3}[a-zA-Z]{2,3}$";

    /**//  w  w  w  .  j av  a  2  s.c om
     * Return true if Email has a valid format
     */
    public static boolean isEmailValid(String email) {

        if (email == null) {
            return false;
        }

        Pattern pattern = Pattern.compile(REGEX_EMAIL);
        Matcher matcher = pattern.matcher(email);
        return matcher.matches();
    }
}

Related

  1. isEmailAddressFormat(String address)
  2. isEmailAddressValid(String emailAddress)
  3. isEmailer(String email)
  4. isEmailFormatValid(String emailAddress)
  5. isEmailValid(String address)
  6. isEmailValid(String email)
  7. isEmailValid(String email)
  8. isEmailValid(String emailAddress)
  9. isLegarEmail(String email)