Skip to main content
Numbers & Finance · In-Browser Regular Expression Lab

US Phone Regex — Match (555) 555-5555, 555-555-5555, and 10 Digits

Flexible US phone number validator matching standard parentheses, hyphens, and spaces.

Flags:
//none
Match Found
Load Sample:
Match Inspection & Details1 match
Match #1:(555) 234-5678

Test Samples Verification Matrix

Expected Valid Samples (Should Match)

(555) 234-5678 Pass
555-234-5678 Pass
+1 555 234 5678 Pass
5552345678 Pass

Expected Invalid Samples (Must Reject)

123-456-7890 Rejected (Pass)
555-012-3456 Rejected (Pass)
555-5555 Rejected (Pass)
Code Implementation Generator
// JavaScript / TypeScript (ES6+)
const pattern = /^(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})$/;
const text = "(555) 234-5678";

const isMatch = pattern.test(text);
console.log("Is Match:", isMatch);

if (isMatch) {
  const matches = text.match(pattern);
  console.log("Matches:", matches);
}

Regular Expression Token Breakdown

Validates North American Numbering Plan (NANP) rules with area code and exchange restrictions. Each component of the regular expression serves a distinct syntactical purpose as mapped below:

Token PatternName / ComponentFunction & Rule
(?:\+?1\s*)?Optional Country CodeOptional +1 prefix for North America.
\(\s*...\s*\)Area Code3-digit area code with optional parentheses.
[.-]?DelimitersOptional dash, dot, or space separators.
[0-9]{4}$Line NumberFinal 4-digit station number.

Frequently Asked Questions

Why are area codes starting with 0 or 1 invalid?
NANP rules specify that area codes must begin with digits 2 through 9.
Browse All 40 Patterns