正则表达式1 - 判断手机号码
作者:
geaosu | 来源:发表于
2017-09-14 17:57 被阅读0次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();
}
本文标题:正则表达式1 - 判断手机号码
本文链接:https://www.haomeiwen.com/subject/jandsxtx.html
网友评论