当前位置:网站首页>2020,最新手机号码手机验证正则表达式,持续更新
2020,最新手机号码手机验证正则表达式,持续更新
2022-07-01 18:34:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
最近在跟一个别人写好上线的项目,今天出了一个bug,部分正常的手机号验证格式不通,查看了代码发现正则表达式有较大的错误,如图:
存在的问题: 1.存在逗号
2.不够全面,部分正常的手机号验证不通过
所以决定自己写,百度一下手机号的格式,下面应该是比较全面,所以就自己根据下面的写验证的正则表达式,如有小伙伴发现下图仍有遗漏请在评论指出,我看到会马上更新
最后写出来的正则表达式:(经网友提示下面正则表达式有缺漏,130,181,180)不能通过
Pattern p = Pattern.compile("^1(3([1-35-9]\\d|4[1-8])|4[14-9]\\d|5([0-25689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8[2-9]\\d|9[89]\\d)\\d{7}$");
Matcher m = p.matcher(mobile);
2020-07-15更新修改后的代码:
Pattern p = Pattern.compile("^1(3([0-35-9]\\d|4[1-8])|4[14-9]\\d|5([0125689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[89]\\d)\\d{7}$");
Matcher m = p.matcher(mobile);
2020-09-24更新,新增191,193,195手机号
经网友提示存在191,195手机号,结合下面新闻
Pattern p = Pattern.compile("^1(3([0-35-9]\\d|4[1-8])|4[14-9]\\d|5([0125689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[13589]\\d)\\d{7}$");
Matcher m = p.matcher(mobile);
2020-11-07更新,经提醒缺少153的手机号码
Pattern p = Pattern.compile("^1(3([0-35-9]\\d|4[1-8])|4[14-9]\\d|5([0-35689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[13589]\\d)\\d{7}$");
Matcher m = p.matcher(mobile);
2021-01-12更新,经提醒缺少1349的手机号码
Pattern p = Pattern.compile("^1(3\\d{2}|4[14-9]\\d|5([0-35689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[13589]\\d)\\d{7}$");
Matcher m = p.matcher(mobile);
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/130799.html原文链接:https://javaforall.cn
边栏推荐
- Force buckle day33
- 2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
- On the language internationalization of Yongzhong Office
- 搭建一个通用监控告警平台,架构上需要有哪些设计
- Is it safe to open a securities account? Is there any danger
- Write an open source, convenient and fast database document query and generation tool with WPF
- Solution: you can ping others, but others can't ping me
- Technology implementation and Architecture Practice
- PCL learning materials
- Lumiprobe biomolecular quantification - qudye Protein Quantification Kit
猜你喜欢
必看,时间序列分析
Blue Bridge Cup real topic: the shortest circuit
AI 训练速度突破摩尔定律;宋舒然团队获得RSS 2022最佳论文奖
Database - MySQL advanced SQL statement (I)
Bug of QQ browser article comment: the commentator is wrong
Mise en place d'une plate - forme générale de surveillance et d'alarme, quelles sont les conceptions nécessaires dans l'architecture?
Localization through custom services in the shuttle application
主成分计算权重
实现一个Prometheus exporter
Leetcode203 移除链表元素
随机推荐
A database editing gadget that can edit SQLite database. SQLite database replaces fields. SQL replaces all values of a field in the database
LeetCode-21合并两个有序链表
搭建一个通用监控告警平台,架构上需要有哪些设计
On the language internationalization of Yongzhong Office
Basic knowledge and commands of disk
PTA year of birth
Sum of three numbers
Mysql database of easyclick
Mujoco's biped robot Darwin model
Lumiprobe 双功能交联剂丨Sulfo-Cyanine5 双-NHS 酯
Localization through custom services in the shuttle application
Highly reliable program storage and startup control system based on anti fuse FPGA and QSPI flash
2、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》启动并运行您的本地环境
Find all missing numbers in the array
C language learning notes: type definition typedef and declaration external CSDN creation punch in
Database - MySQL advanced SQL statement (I)
code
主成分之综合竞争力案例分析
Search 2D matrix 2
Mujoco XML modeling