What are the rules for validating a North American phone number? Also, is there a regex
I can use? Is there a gem to do this?
Here are few rules I have
The rules I used in my perl code for validating NANP phone numbers came from an email sent by Doug Newell to the telnum-l mailing list, which I reproduce below, somewhat simplified to only consider full 10 digit numbers:
The number 10 digits long. We'll call this pattern:
ABC DEF XXXX
A may not be 0 or 1.
B may not be 9.
A+B may not be 37 or 96.
B+C may not be 11.
D may not be 0 or 1.
You may be able to extract a regex from libphonenumber's metadata, but beware, it is GNARLY AS HELL.