Java Email Validate isEmail(String str)

Here you can find the source of isEmail(String str)

Description

is Email

License

Open Source License

Declaration

public static boolean isEmail(String str) 

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 {
    private static final String REGEX_EMAIL = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";

    public static boolean isEmail(String str) {
        return regex(str, REGEX_EMAIL);
    }/*from  w w w  .  j  a  v a 2  s  . c o m*/

    public static final boolean regex(String testStr, String regStr) {
        Pattern p = Pattern.compile(regStr);
        Matcher m = p.matcher(testStr);
        return m.matches();
    }
}

Related

  1. isEmail(String msg)
  2. isEmail(String s)
  3. isEmail(String str)
  4. isEmail(String str)
  5. isEmail(String str)
  6. isEmail(String str)
  7. isEmail(String str)
  8. isEmail(String str, boolean nullCheck)
  9. isEmail(String string)