Android使用正则表达式验证手机号

国内手机号代码段分配如下:

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

验证代码如下:

 public static boolean isMobileNO(String mobiles) {  
            Pattern p = Pattern  
                    .compile("^((13[0-9])|(15[^4,\D])|(18[0,5-9]))\d{8}$");  
            Matcher m = p.matcher(mobiles);  
            System.out.println(m.matches() + "---");  
            return m.matches();  
        } 
原文地址:https://www.cnblogs.com/tony-yang-flutter/p/3337181.html