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

What are the regular expressions for mobile phone number verification in Android

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

The purpose of this article is to share with you what regular expressions are available for mobile number verification in Android. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The details are as follows:

/ * determine whether the string conforms to the mobile number format * Mobile number segment: 1341351371381381391471501152157159170183184187188 * Unicom segment: 130131132145155156170175176185186 * Telecom segment: 133149153173177181181189 * @ param str * @ return string to be tested * / public static boolean isMobileNO (String mobileNums) {/ * determine whether the string conforms to the mobile number format * Mobile segment: 1341351361371381381391471501152157159178172184187188 * Telecom segment: 1301132145155176176175185185186 * Telecom number range: 133149153170173177180181189 * @ param str * @ return string to be tested * / String telRegex = "^ ((13 [0-9])) | (14 [5prime7] 9]) | (15 [^ 4]) | (18 [0-9]) | (17 [0meme 1meme 3rem 5je 7je 8]))\\ d {8} $" / / "[1]" represents the first digit is the number 1, "[358]" represents the second digit can be one of 3, 5, 8, and "\ d {9}" represents a number that can be 0,9. If (TextUtils.isEmpty (mobileNums)) return false; else return mobileNums.matches (telRegex);}

"^ (13 [0-9])) | (14 [5magee 7pr 9]) | (15 [^ 4]) | (18 [0-9]) | (17 [0primel, 1meme, 3pr, 6pr, 7pr 8]))\ d {8} $" is actually very simple:

The first three digits of ① 130139 have all been opened, and each of the last eight digits is any number between 0 and 9.

At present, there are only 145,147,149 digits at the beginning of ② 14, and each of the last 8 digits is any number between 0 and 9.

The third digit at the beginning of ③ 15 is optional except 154.Each of the last eight digits is any number between 0 and 9.

The first three digits of ④ 180-189have all been opened, and each of the last eight digits is any number between 0 and 9.

At present, there are 170,171,173,175,176,177,178 at the beginning of ⑤ 17, and each of the last eight digits is any number between 0 and 9.

These regular expressions are only judged at the front end, and in the actual development, the data will still be passed to the background, and the background will judge whether the 11-digit number is a mobile phone number in the database. We write this in order to filter some of the most basic numbers. Make sure that the number entered is 11 digits, and there are some 11 digits that do not seem to be mobile phone numbers.

Thank you for reading! This is the end of this article on "what are the regular expressions for verifying mobile phone numbers in Android?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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