Android Email String Validate emailValidator(final String mailAddress)

Here you can find the source of emailValidator(final String mailAddress)

Description

This method used to email validator.

Parameter

Parameter Description
mailAddress represented email

Return

represented

Declaration

public static boolean emailValidator(final String mailAddress) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**//from ww w .j a v  a  2 s  . c om
     * This method used to email validator.
     * 
     * @param mailAddress
     *            represented email
     * @return represented {@link Boolean}
     */
    public static boolean emailValidator(final String mailAddress) {

        Pattern pattern;
        Matcher matcher;

        final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
                + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

        pattern = Pattern.compile(EMAIL_PATTERN);
        matcher = pattern.matcher(mailAddress);
        return matcher.matches();

    }
}

Related

  1. isEmailValid(String email)
  2. checkMail(String email)
  3. isEmail(String s)
  4. isValidEmail(String email)
  5. isValidEmail(CharSequence target)
  6. validateEmail(String aEmailAddress)
  7. validateEmail(final String email)