Advertisement

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

Test it: match & no-match examples

Every row is loaded straight into the tester — click Try to see the match live:

InputResultWhy
(123) 456-7890Matchparenthesized area codeTry →
123-456-7890Matchdashed formatTry →
1234567890Matchdigits onlyTry →
+1 123 456 7890Matchwith country codeTry →
123456789No match9 digitsTry →
abcNo matchnot a phoneTry →

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.
Open the regex tester →

FAQ

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.