Java Email Validate validEmail(String email)

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

Description

Valid email.

License

Apache License

Parameter

Parameter Description
email the email

Return

true, if successful

Declaration

public static boolean validEmail(String email) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    /** The Constant VALID_EMAIL_PATTERN. */
    private static final String VALID_EMAIL_PATTERN = "^[\\w\\.=-]+@[\\w\\.-]+\\.[\\w]{2,5}$";

    /**//from w  w w .  j  a  va  2s. c  o  m
     * Valid email.
     *
     * @param email the email
     * @return true, if successful
     */
    public static boolean validEmail(String email) {

        Pattern pattern = Pattern.compile(VALID_EMAIL_PATTERN);
        Matcher matcher = pattern.matcher(email);

        return matcher.find();
    }
}

Related

  1. validateEmail(String email)
  2. validateEmail(String hex)
  3. validateEmail2(String field)
  4. validateEmailAddress(String address)
  5. validEmail(String canidate)
  6. validEmail(String p_mail)
  7. validEmailAddrWithDataExact(String str)