Android Email String Validate validateEmail(final String email)

Here you can find the source of validateEmail(final String email)

Description

Validate hex with regular expression

Parameter

Parameter Description
hex hex for validation

Return

true valid hex, false invalid hex

Declaration

public static boolean validateEmail(final String email) 

Method Source Code

//package com.java2s;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    private static Pattern _emailPattern;
    private static final String _EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

    /**/*from   w  w w . j  a va 2 s.co  m*/
     * Validate hex with regular expression
     * @param hex hex for validation
     * @return true valid hex, false invalid hex
     */
    public static boolean validateEmail(final String email) {
        if (_emailPattern == null)
            _emailPattern = Pattern.compile(_EMAIL_PATTERN);
        Matcher matcher = _emailPattern.matcher(email);
        return matcher.matches();
    }
}

Related

  1. isEmail(String s)
  2. isValidEmail(String email)
  3. isValidEmail(CharSequence target)
  4. emailValidator(final String mailAddress)
  5. validateEmail(String aEmailAddress)