Sponsors

1

Python

r"

[2-9]([0-8])(?!\1)\d-?[2-9](?!1(?=1))\d\d-?\d{4}

"

gm

Match 10-digit phone number that mostly complies with NANP Modern Plan.

https://en.wikipedia.org/wiki/North_American_Numbering_Plan

Simple explanation:

Digit 1: must be between 2-9 Digit 2: must be between 0-8 Digit 3: any digit, but not the same as digit 2 Digit 4: must be between 2-9 Digit 5: any digit Digit 6: any digit, but must not be 1 if digit 5 is 1 Digits 7-10: any digit

What is missing: does not exclude matches for 555-0100 through 555-0199

Submitted by makinhey - 5 months ago (Last modified 5 months ago)