Well, do you see the regular expression?
Code:
/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/
That means:
- ^ this is the start of the number
- (1-?)? an optional non-zero digit
- [2-9]\d{2} 3-digits from 200 upwards
- (/(...\)|...) optional parenthesis for area code
- -? optional divider
- [2-9]\d{2} 3-digits from 200 upwards
- -? optional divider
- \d{4} four more digits
- $ end of the number
When you figure out what formats are acceptable and which are not, we can craft together a regular expression for you that will make matching them a breeze.
Bookmarks