正则匹配 手机号 ,举个例子
时间: 2023-12-13 17:44:07 浏览: 66
java针对电话号码正则匹配实例
答案:
举个例子,假设我们要使用正则表达式来匹配手机号码。根据引用和引用中提供的代码,我们可以使用以下正则表达式来匹配手机号码:
/^0?(13|14|15|17|18)[0-9]{9}$/
这个正则表达式会匹配以0开头的手机号码,后面跟着13、14、15、17或18,然后是任意9个数字。如果手机号码符合这个正则表达式的规则,那么匹配将成功。比如,手机号码13812345678会匹配这个正则表达式。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [php 正则如何匹配手机号码呢?](https://blog.csdn.net/sfi799/article/details/115463134)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *2* [JS正则匹配手机号是否正确](https://blog.csdn.net/m0_51969330/article/details/121578361)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *3* [正则匹配之正则匹配全部汇总:](https://blog.csdn.net/Remix_xy/article/details/127001584)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文