文档介绍:Android严格验证手机号码正则表达式
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class ClassPathResource {
public static boolean isMobileNO(String mobiles) {
Pattern p = Pattern
.compile("^((13[0-9])|(15[^4,//D])|(18[0,5-9]))//d{8}$");
Matcher m = (mobiles);
(() + "---");
return ();
}
public static void main(String[] args) throws IOException {
(("**********"));
}
}
要严格的验证手机号码,必须先要清楚现在已经开放了哪些数字开头的号码段,目前国内号码段分配如下:
移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188
联通:130、131、132、152、155、156、185、186
电信:133、153、180、189、(1349卫通)