Pattern library / Numbers & Codes
Regex to Match US Phone Numbers
Accepts 1234567890, (123) 456-7890, 123-456-7890. Rejects 9- or 11-digit inputs.
The pattern
^(\+?1[-.\s]?)?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$
Load this pattern into the tester →
How the pattern works
(\+?1[-.\s]?)?— optional country code 1.\(?[0-9]{3}\)?— area code with optional parens.[-.\s]?— optional separator between groups.- Regex validates shape; verify area code validity in code.
Test it: match & no-match examples
Every row is loaded straight into the tester — click Try to see the match live:
| Input | Result | Why | |
|---|---|---|---|
(123) 456-7890 | Match | parenthesized area code | Try → |
123-456-7890 | Match | dashed format | Try → |
1234567890 | Match | digits only | Try → |
+1 123 456 7890 | Match | with country code | Try → |
123456789 | No match | 9 digits | Try → |
abc | No match | not a phone | Try → |
Where to use it
JavaScript
const re = /^(\+?1[-.\s]?)?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$/;
re.test('(123) 456-7890'); // true
Python
import re
re.match(r'^(\+?1[-.\s]?)?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$', '(123) 456-7890')
Common mistakes
Test this pattern on your own data
Paste it into the free tester with your real strings — nothing leaves your browser.
FAQ
Related patterns
For GA4-specific patterns, see the GA4 regex cheat sheet, the page path regex guide, the event filter regex guide, the GA4 regex match types, the custom channel grouping guide and RE2 vs PCRE. Browse the full regex pattern library.