首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

更严厉的手机号码正则表达式写法

2012-09-21 
更严格的手机号码正则表达式写法public class ClassPathResource {public static boolean isMobileNO(Stri

更严格的手机号码正则表达式写法
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 = p.matcher(mobiles);       
        System.out.println(m.matches()+"---");       
        return m.matches();       
    }       
    public static void main(String[] args) throws IOException {       
        System.out.println(ClassPathResource.isMobileNO("18616155153"));       
    }    
}   



故先要整清楚现在已经开放了多少个号码段,国家号码段分配如下:

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

热点排行