Java uses regular expressions to determine mobile phone numbers

This article describes how Java uses regular expressions to judge mobile phone numbers. Share with you for your reference, as follows:

To match the mobile phone number more accurately, it is not enough to match only 11 digits. For example, there is no number segment starting with 144,

Therefore, it is necessary to clarify how many number segments have been opened. The distribution of national number segments is as follows:

Mobile: 134, 135, 136, 137, 138, 139, 150, 151, 157 (TD), 158, 159, 187, 188 Unicom: 130, 131, 132, 152, 155, 156, 185, 186 Telecom: 133, 153, 180, 189, (1349 SATCOM)

So now you can do the regular matching test,

The second method:

PS: here are two very convenient regular expression tools for your reference:

JavaScript regular expression online test tool: http://tools.jb51.net/regex/javascript

Regular expression online generation tool: http://tools.jb51.net/regex/create_reg

For more information about Java algorithms, readers who are interested can see the topics on this site: complete collection of Java regular expression skills, tutorial on Java data structure and algorithms, summary of Java DOM node operation skills, summary of java file and directory operation skills, and summary of Java cache operation skills

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>