正则校验手机号
程序员文章站
2022-05-01 22:00:10
...
public class test {
public static void main(String[] args) {
String content = "15111111111";
System.out.println(isMobile(content));
}
public static boolean isMobile(String mobile) {
String REGEX_MOBILE = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$" ;
return Pattern.matches(REGEX_MOBILE, mobile);
}
}