正则表达式1 - 判断手机号码
2017-09-14 本文已影响0人
geaosu
public static boolean checkEmail(String email) {
String str = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
Pattern p = Pattern.compile(str);
Matcher m = p.matcher(email);
return m.matches();
}
public static boolean checkNumber(String number) {
String str = "^[0-9]*[0-9][0-9]*$";
Pattern p = Pattern.compile(str);
Matcher m = p.matcher(number);
return m.matches();
}
public static boolean checkMobileNO(String value) {
Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(14[0-9])|(17[0-9])|(18[0-9]))\\d{8}$");
Matcher m = p.matcher(value);
return m.matches();
}