首页 编程 软件学院 查看内容

Android正则表达式

2015-10-8 15:30 2141 0

摘要: 要严格的验证手机号码,必须先要清楚现在已经开放了哪些数字开头的号码段,目前国内号码段分配如下:移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188联通:130、131、132、152、155、15 ...
关键词: nbsp important ClassPathResourc auto 0px public static isMobileNO 验证 号码

要严格的验证手机号码,必须先要清楚现在已经开放了哪些数字开头的号码段,目前国内号码段分配如下:

移动: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卫通)

验证手机号:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class ClassPathResource {
  public static boolean isMobileNO(String mobiles) {
    Pattern p = Pattern
        .compile("^(([-])|([^,//D])|([,-]))//d{}$");
    Matcher m = p.matcher(mobiles);
    System.out.println(m.matches() + "---");
    return m.matches();
  }
  public static void main(String[] args) throws IOException {
    System.out.println(ClassPathResource.isMobileNO("" 声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论