JAVA 正则表达式验证手机号码
String regex = "^1[345678]\\d{9}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher("111111111111");
if(!matcher.matches()){
System.out.println("格式不正确");
}
String regex = "^1[345678]\\d{9}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher("111111111111");
if(!matcher.matches()){
System.out.println("格式不正确");
}