Home >Web Front-end >JS Tutorial >Regular expression to verify domestic mobile phone number and landline number

Regular expression to verify domestic mobile phone number and landline number

php中世界最好的语言
php中世界最好的语言Original
2018-03-13 09:18:434758browse

这次给大家带来验证国内手机号与座机号的正则表达式,验证国内手机号与座机号的正则表达式的注意事项有哪些,下面就是实战案例,一起来看一下。

验证手机号:^((13[0-9])|(14[7])|(15[^4,\\D])|(18[0,0-9])|(17[0,0-9]))\\d{8}$
验证座机和手机号:@"^(0(10|2[0-5789]|3\\d{2}|4\\d{2}|5\\d{2}|6\\d{2}|7\\d{2}|8\\d{2}|9\\d{2})\\d{7,8}$)|(0(10|2[0-5789]|3\\d{2}|4\\d{2}|5\\d{2}|6\\d{2}|7\\d{2}|8\\d{2}|9\\d{2})-\\d{7,8}$)|(\\d{7,8}$)|(((13[0-9])|(14[7])|(15[^4,\\D])|(18[0,0-9])|(17[0,0-9]))\\d{8}$)    (目前座机不支持分机号)

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

react.js的学习

Angular的新手教程

怎样用代码直观的表示mvvm原理

The above is the detailed content of Regular expression to verify domestic mobile phone number and landline number. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Learning react.jsNext article:Learning react.js