Android Email String Validate isLegalEmail(String email)

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

Description

is Legal Email

Declaration

public static boolean isLegalEmail(String email) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static boolean isLegalEmail(String email) {
        String strPattern = "^[a-zA-Z0-9][a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]"
                + "@[a-zA-Z0-9][a-zA-Z0-9\\-_]*[a-zA-Z0-9]\\."
                + "([a-zA-Z0-9][a-zA-Z0-9\\-_]*[a-zA-Z0-9]\\.)*[a-zA-Z0-9]*$";

        Pattern p = Pattern.compile(strPattern);
        Matcher m = p.matcher(email);
        return m.matches();
    }//w  ww. j  av a2 s .c  om
}

Related

  1. isEmail(String str)
  2. isEmail(String strEmail)
  3. isEmail(String string)
  4. isEmail(String strEmail)
  5. getNameFromEmail(String email)
  6. isEmail(String str)
  7. isEmail(String email)
  8. isEmail(String text)
  9. isEmailFormat(String email)