Regular expression to determine the type of mobile phone number Liang

Source: Internet
Author: User

Many websites need to keep a good membership number or use it for future profits. The implementation method is not the scope of this article, this article only lists some of the regular ones used to detect the type of the hot number.

Beautiful number detection: The main can detect the connection number (positive connection 12345, 65432), AABB number, mobile phone number, date number (birthday, annual), Abbcabb, 3 more than repeat number. More type number detection can be modified according to the following expression.

' Match 6-bit shun-increase
Regex. Pattern = "(?: 0 (? =1) | (? =2) (? =3) |3 (? =4) |4 (? =5) |5 (? =6) |6 (? =7) |7 (? =8) |8 (? =9)) {5}\d ")

' Match 6-bit straight-down
Regex. Pattern = "(?: 9 (? =8) |8 (? =7) |7 (? =6) |6 (? =5) |5 (? =4) |4 (? =3) (|3) (?) (? =2) | | (? =1)) {=0]

' Match 6-bit straight up or down
Regex. Pattern = "(?:(?: 0 (? =1) | (? =2) (? =3) |3 (? =4) |4 (? =5) |5 (? =6) |6 (? =7) |7 (? =8) |8 (? =9)) {5}| (?: 9 (? =8) |8 (? =7) |7 (? =6) |6 (? =5) |5 (? =4) |4 (? =3) (?) (?) (? |3) | | (? =2)) {5}) =1 "

Match 4-9-bit sequential numbers
(?:(?: 0 (? =1) | (? =2) (? =3) |3 (? =4) |4 (? =5) |5 (? =6) |6 (? =7) |7 (? =8) |8 (? =9)) {3,}| (?: 9 (? =8) |8 (? =7) |7 (? =6) |6 (? =5) |5 (? =4) |4 (? =3) (?) (?) (? |3) | | (? =2)) {3,}) =1

Matches more than 3 digits of duplicate numbers
([\d]) \1{2,}

Numbers that match date types
(19|20) [\d] {2} (1[0-2]|0?) [1-9]) (31|2[0-9]|1[0-9]|0?) [0-9])

Mobile phone Number class
(13[0-9]|15[0-9]|18[0-9]) ([\d]{2,4}) {2}

Match 33111 types of
([\d]) \1{1,} ([\d]) \2{2,}

Match 5331533 types of
([[\d]) {1,} ([\d]) {1,}) \1{1,}

Matches the 22334,123355 type of
([\d]) \1{1,} ([\d]) \2{1,}

The above are all in Mtracer 2.0 debugging and in the practical application of the adoption, welcome to express their views and share their own technology and experience.

Regular expression to determine the type of mobile phone number Liang

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.