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
If you want something more advanced than a regex, Twilio has an API that can do this:
Twilio Lookup is a REST API that can:
- Verify that a phone number exists
- Format any international phone number into its local standard
- Determine if a phone number is a cell phone, VOIP or landline
- Discover information about a phone number’s carrier
I haven't used this yet! But it should work, though you do need a (free) Twilio account. (Also I'm not affiliated with Twilio, other than having a free account I'm playing with.)