A Decent Phone Number Regex

There are countless poorly written regex functions for validating and extracting phone numbers from a string. Here's one I wrote that is specifically designed for personal and commercial US phone numbers
^(1\-)?(\(?)([\d]{3})(?:[^\d]{0,2})(((\d{3})(?:[^\d]?)([\d\w]{4}))|([\w]{7}))$
Matches
425-233-1231
232.111.4444
232-321.2321
(232) 444 2212
(423)424-2321
3423422234
999-211-HOPE
1-800-WINNING
1-822-CARPET2
Does NOT match
1-800-SHORT
fasease
NOTTHIS
321-1212
911
Small dog web development studio

View All Our Posts

Web application developers in western Washington, creating user centric web solutions for businesses of all shapes and sizes.

Our projects include ecommerce, event organization, user driven web applications and more.


Small Dog Studios, LLC. Small Dog Studios News