Regular expression Number Liang type judgment code-regular expression

Source: Internet
Author: User
Liang number detection: The main can detect the serial number (even 12345, pour 65432), AABB number, mobile phone number, date number (birthday number, annual number), Abbcabb number, 3-digit repeat number. More types of number detection can be modified according to the following expression.

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

' Match 6-digit descending
Regex. Pattern = "(?: 9 (? =8) |8 (?) =7) |7 (? =6) |6 (? =5) |5 ("=4") |4 (? =3) |3 (? =2) =1 (? |1) (?)

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

Matching 4-9-bit sequential numbers
(?:(?: 0 (? =1) |1 |3 (? =4) |4 (=5) |5 (? =6) |6 (? =7) (? =2) =9)) {3,}| (?: 9 (? =8) |8 (?) =7) |7 (? =6) |6 (? =5) |5 ("=4") |4 (? =3) |3 (? =2) (? =1) |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 Category
(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,}

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


The above are all in the Mtracer 2.0 debugging and through the practical application, you are welcome to express their views and share their own skills and experience.

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.