Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the regular expression of Mobile phone number and phone number Verification

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to realize the regular expression of mobile phone number and phone number verification. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

First of all, let's take a look at the concept of regular expression. Regular expression (regular expression) describes a pattern of string matching, which can be used to check whether a string contains a certain substring, replace a matching substring, or extract a substring that meets a certain condition from a string.

/ ^ 1 (?: 3\ d | 4 [4-9] | 5 [0-35-9] | 6 [67] | 7 [013-8] | 8\ d | 9\ d)\ d {8} $/

Regular expression of all legitimate mobile phone numbers in China

Java Mobile phone number regular expression:

/ * * verify mobile phone number * * Mobile number range: 139, 138, 137, 136, 135, 134, 150, 151, 152, 157, 158, 159, 182, 183, 187, 188, 147 * Unicom number range: 130, 131, 132, 136, 185, 186, 145 * Telecommunication number range: 133, 153, 180, 1890 * * @ param cellphone * @ return * / public static boolean checkCellphone (String cellphone) {String regex = "^ ((13 [0-9])) | (14 [5 | 7]) | (15 ([0-3] | [5-9])) | (18 [0LJ 5-9]))\\ d {8} $" Return check (cellphone, regex); * * @ param telephone * @ return * / public static boolean checkTelephone (String telephone) {String regex = "^ (0\ d {2} -\ d {8} (-\ d {1jue 4})?) | (0\\ d {3} -\ d {7jue 8} (-\\ d {1pm 4})?) $"; return check (telephone, regex);}

Regular expression of php Mobile phone number

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report