Regex Guide · Prompt: “Match 10-digit US phone numbers with optional +1, parentheses, spaces, dots, or hyphens”

Match and Normalize US Phone Numbers with Regex

Verified by LiveFormulaLab Engineering Team • Updated November 2026

Match and normalize US/North American phone numbers formatted with parentheses, hyphens, dots, or +1 country code using Regex live.

Verified Regex Syntax

(?:\+1[-.\s]?)?\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})

How This Formula Works (Step-by-Step)

Customer phone numbers arrive in inconsistent formats like (415) 555-0192, 415.555.0192, or +1-415-555-0192.

Step 1: (?:\+1[-.\s]?)? optionally skips an international +1 prefix.

Step 2: Three capture groups (\d{3}), (\d{3}), and (\d{4}) isolate the area code, exchange, and line digits for easy reformatting.

Formula Syntax & Arguments Breakdown

Matches optional "+1" country prefixes and variable punctuation while isolating the 3-digit area code, 3-digit exchange prefix, and 4-digit line number into clean capture groups ready for standardization.

Argument / ClauseRequirementData TypeRole & Behavior
(?:\+1[-.\s]?)?OptionalCountry PrefixSkips an optional US/Canada +1 dialing code and separator without creating a capture group.
\(?(\d{3})\)?RequiredCapture Group 1 (Area)Captures the 3-digit area code whether wrapped in parentheses or written plain.
[-.\s]?(\d{3})[-.\s]?(\d{4})RequiredGroups 2 & 3Captures the 3-digit central office exchange and 4-digit subscriber number separated by optional hyphens, dots, or spaces.

3 Real-World Use Cases

  • Standardizing messy CRM phone columns into uniform (XXX) XXX-XXXX strings.
  • Redacting personal phone numbers from public support logs.
  • Validating checkout contact numbers in web forms.

Cross-Platform Equivalents

Excel
=REGEXREPLACE(A2, "(?:\+1[-.\s]?)?\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})", "($1) $2-$3")
SQL
SELECT REGEXP_REPLACE(phone, '[^0-9]', '', 'g') AS digits_only FROM leads;
Python Pandas
df['phone_clean'] = df['phone'].str.replace(r'(?:\+1[-.\s]?)?\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})', r'(\1) \2-\3', regex=True)

Common Mistakes & Pro Tips

Pitfalls & How to Fix Them

  • Mistake: Matching (\d{3})? with unescaped parentheses throws an invalid syntax or wrong-group error.

    Fix: Escape literal parentheses with backslashes: \(?(\d{3})\)?.

  • Mistake: Matching inside long numeric order IDs extracts false 10-digit substrings.

    Fix: Add \b boundaries or ^...$ anchors when validating dedicated phone number columns.

  • Mistake: Reformatting phone numbers with hardcoded "-" fails if you forget capture group indices.

    Fix: Replace matches with "($1) $2-$3" or "+1-$1-$2-$3" to standardize every CRM phone record uniformly.

Engineering Pro Tips

  • Strip all non-digits via REGEXP_REPLACE(phone, '[^0-9]', '') when storing canonical E.164 or 10-digit keys in SQL.
  • Avoid overly strict NANP first-digit rules unless strictly verifying live carrier numbers, as test fixtures like 555-0192 use reserved ranges.
  • Runs cleanly in JavaScript, Python, SQL, Excel 365, and Google Sheets REGEXREPLACE.
  • Use replacement template "($1) $2-$3" inside Google Sheets REGEXREPLACE to normalize messy CRM exports cleanly.

Frequently Asked Questions

How do I reformat captured groups into (415) 555-0192?
Replace matches with ($1) $2-$3 using REGEXREPLACE or String.prototype.replace.
How do I prevent matching 12-digit IDs that contain a 10-digit substring?
Add word boundaries \b at the end or ^...$ anchors when validating a standalone cell.
Can this work inside Google Sheets REGEXREPLACE?
Yes: =REGEXREPLACE(A2, "(?:\+1[-.\s]?)?\(?(\d{3})\)?[-.\s]?(\d{3})[-.\s]?(\d{4})", "($1) $2-$3").

Related Formulas & Guides