Blog
Custom Print on Demand Apparel — Free Storefront for Your Business
Wild & Free Tools

Email & Phone Number Regex Patterns — Test & Validate Online

Last updated: April 20267 min readDeveloper Tools

You are writing a signup form and need an email regex that does not reject real users or accept garbage. Here are the patterns that work in production, with honest notes on what they miss and when to use something else.

Email Validation Regex Patterns

Pattern NameRegexCatchesMisses
Simple (recommended)^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$99%+ of real emailsQuoted local parts, IP domains
Strict TLD^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,63}$Same + caps TLD lengthSame as simple
With subdomains^[a-zA-Z0-9._%+-]+@([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}$[email protected]Quoted local parts
Ultra-permissive^.+@.+\\..+$Everything with @ and a dotAlmost nothing — too loose

Use the simple pattern. It catches the real emails your users type. Do not use the RFC 5322 regex (it is 6,300+ characters long). No one has an email address that needs it. Send a confirmation email instead — that is the real validation.

Email Pattern Breakdown

Taking the recommended pattern apart:

Test this pattern with your real user data before shipping it.

Phone Number Regex Patterns

FormatRegexExample Matches
US flexible^\\+?1?[-.\\s]?\\(?\\d{3}\\)?[-.\\s]?\\d{3}[-.\\s]?\\d{4}$(555) 123-4567, 555-123-4567, +1 555 123 4567
US strict (10 digits)^\\d{3}-\\d{3}-\\d{4}$555-123-4567 only
US digits only^\\d{10}$5551234567
International E.164^\\+[1-9]\\d{6,14}$+14155551234, +442071234567
With extension^\\+?\\d[\\d\\s.-]{6,14}(\\s?(ext|x)\\.?\\s?\\d{1,6})?$+1 555-123-4567 ext 890

Common Validation Mistakes

  1. Blocking plus signs in emails[email protected] is valid. Gmail, Outlook, and others support plus addressing for filtering. Your regex must allow + in the local part.
  2. Requiring 3-letter TLDs.co, .io, .ai are 2-letter TLDs. .photography is 11 letters. Use {2,} not {3}.
  3. Hardcoding US phone format — if you have international users, \d{3}-\d{3}-\d{4} rejects every non-US number. Use the E.164 pattern or a phone library.
  4. Not anchoring with ^ and $ — without anchors, \d{10} matches "call 5551234567 now" because 10 digits exist inside the string. Anchor the pattern to validate the entire input.
  5. Trusting regex alone[email protected] passes every email regex. Send a confirmation email. For phones, send an SMS code. Regex checks format, not existence.

Test Before You Ship

Copy any pattern above, open the Regex Tester, and paste it. Then paste these test strings to check edge cases:

If your pattern rejects a valid input or accepts an invalid one, adjust before deploying. Five minutes of testing saves hours of debugging user complaints.

Developer Tool Stack for Validation

Test your email and phone regex patterns before they hit production.

Open Regex Tester
Launch Your Own Clothing Brand — No Inventory, No Risk