验证固话或者手机号的正则表达式
时间: 2023-08-17 19:11:58 浏览: 96
Java使用正则表达式验证手机号和电话号码的方法
验证固话或手机号的正则表达式可以使用以下两个引用中提供的规则:
引用\[1\]中的规则:
- 座机号验证规则:/^((0\d{2,3}(-)?\d{7,8})|(13\[0-9\]|14\[01456879\]|15\[0-35-9\]|16\[2567\]|17\[0-8\]|18\[0-9\]|19\[0-35-9\])\d{8})$/
引用\[2\]中的规则:
- 手机号验证规则:/^1\[3456789\]\d{9}$/
- 固话(座机)验证规则:/^((0\d{2,3})-)?(\d{7,8})$/
你可以根据需要选择其中一个规则进行验证。
#### 引用[.reference_title]
- *1* [正则表达式之座机号/手机号验证校验规则](https://blog.csdn.net/qq_24882245/article/details/126405640)[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^v91^koosearch_v1,239^v4^insert_chatgpt"}} ] [.reference_item]
- *2* [js正则手机或者固话验证](https://blog.csdn.net/rzrfreedom/article/details/126468315)[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^v91^koosearch_v1,239^v4^insert_chatgpt"}} ] [.reference_item]
- *3* [用正则表达式来验证手机号码](https://blog.csdn.net/weixin_45249263/article/details/123773585)[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^v91^koosearch_v1,239^v4^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文