发布于

Java-判断邮箱是否合法

public static boolean isEmail(String string) {
        if (string == null)
            return false;
        String regEx1 = "\\w+@(\\w+.)+[a-z]{2,3}";
        Pattern p;
        Matcher m;
        p = Pattern.compile(regEx1);
        m = p.matcher(string);
        if (m.matches()) {
            return true;
        }else {
            return false;
        }
    }
评论