Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

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

Shulou Source: shulou.com Published: 2022-06-02 03:55:55 10月03日 Update

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

Tags: Number mobile phone mobile number authentication information regular phone expression number phone number China mobile phone number area code beginning article example address character string error Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft OPPO Reno MySQL vpn