匹配手机号方法

/**
     * 匹配手机号方法一
     * 匹配输入的电话号码是否是正确的号码
     * 要更加准确的匹配手机号码值匹配11为数字是不够的
     * 比如说就没有以144开始的号码段
     * 故先要整清楚已经开放了多少个号码段国家号码段分配如下:
     * 移动:134,135,136,137,138,139,159,151,157(TD),158,159,187,188
     * 联通:130,131,132,152,155,156,185,186
     * 电信:133,153,180,189,(1349卫通)
     * @param mobiles
     * @return
     */


    public  boolean isphonenumber(String mobiles) {
        Pattern p=Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
        Matcher m=p.matcher(mobiles);
        return m.matches();
    }

猜你喜欢

转载自blog.csdn.net/qq_42499475/article/details/81672140