Regex for US Phone Numbers — Pattern Explained with Examples
Regex for US Phone Numbers — Pattern Explained with Examples
DodaTech
Updated Jun 20, 2026
2 min read
US phone number validation is essential for forms and contact management systems targeting North American users. This pattern handles the common formatting variations: area code in parentheses, dashes, dots, spaces, and the optional leading 1 country code.
The Pattern
/^\+?1?\s?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$/Pattern Breakdown
| Part | Meaning |
|---|---|
^ | Start-of-string anchor |
\+? | Optional leading plus sign |
1? | Optional country code 1 |
\s? | Optional whitespace after country code |
\(? | Optional opening parenthesis |
[0-9]{3} | Area code — exactly 3 digits |
\)? | Optional closing parenthesis |
[-.\s]? | Optional separator between area code and prefix |
[0-9]{3} | Prefix — exactly 3 digits |
[-.\s]? | Optional separator between prefix and line number |
[0-9]{4} | Line number — exactly 4 digits |
$ | End-of-string anchor |
Matches
- (555) 123-4567
- 555-123-4567
- +1 555 123 4567
- 555.123.4567
- 15551234567
Does NOT Match
- 123-4567 (missing area code)
- 555-123-456 (line number only 3 digits)
- +44 555 123 4567 (UK country code)
- 555-ABCD-EFG (letters in number)
- (555)123-4567 extra (trailing characters)
Language Examples
JavaScript
const phoneRegex = /^\+?1?\s?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$/;
console.log(phoneRegex.test('(555) 123-4567')); // true
console.log(phoneRegex.test('123-4567')); // false
Python
import re
pattern = r'^\+?1?\s?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$'
print(bool(re.match(pattern, '(555) 123-4567'))) # True
print(bool(re.match(pattern, '123-4567'))) # FalseRuby
pattern = /^\+?1?\s?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$/
puts pattern.match?('(555) 123-4567') # true
puts pattern.match?('123-4567') # falseCommon Pitfalls
- This pattern does not validate that the area code is a real US area code —
(000) 000-0000passes - International formats starting with country codes other than +1 will be incorrectly rejected
- Phone number extensions (e.g. x123) are not supported without additional pattern modifications
- Accepting the leading 1 inconsistently can cause duplicate records in databases
Real-World Use Cases
- E-commerce checkout forms — collect valid US billing and shipping contact numbers
- CRM systems — normalize and store customer phone data from multiple input sources
- Two-factor authentication — validate phone format before sending SMS verification codes
FAQ
Related Patterns
Regex for International Phone Numbers Regex for Email
Previous
Regex for Email Validation — Pattern Explained with Examples
Next
Regex for International Phone Numbers — Pattern Explained with Examples
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro