我是靠谱客的博主 活力学姐,这篇文章主要介绍正则表达式验证手机号码(2018年06月19日),现在分享给大家,希望可以做个参考。

正则表达式

"^(0|86|17951)?(13[0-9]|14[056789]|15[012356789]|16[6]|17[345678]|18[0-9]|19[89])[0-9]{8}$"

代码

public static boolean isPhone(String phone) {
    Pattern pattern;
    Matcher matcher;
    String PHONE_PATTERN = "^(0|86|17951)?(13[0-9]|14[056789]|15[012356789]|16[6]|17[345678]|18[0-9]|19[89])[0-9]{8}$";
    pattern = Pattern.compile(PHONE_PATTERN);
    matcher = pattern.matcher(phone);
    return matcher.matches();
}

号段

我在百度百科(手机号)中总结出来的,眼睛都快直了,如果有遗漏,欢迎补充

130 1 2 3 4 5 6 7 8 9
140 5 6 7 8 9
150 1 2 3 5 6 7 8 9
166
173 4 5 6 7 8
180 1 2 3 4 5 6 7 8 9
198 9

最后

以上就是活力学姐最近收集整理的关于正则表达式验证手机号码(2018年06月19日)的全部内容,更多相关正则表达式验证手机号码(2018年06月19日)内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(185)

评论列表共有 0 条评论

立即
投稿
返回
顶部