Phone Number Regex Tester
Test and validate phone patterns with this specialized regex tester. Includes tested patterns and real-time matching.
Recommended Phone Pattern
``regex
^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$
`
Test Examples
Valid matches:
- (555) 123-4567
555-123-4567+1 555 123 45675551234567
Invalid (should not match):
555-123123-456-78901abc-def-ghij
Pattern Explanation
Matches US phone numbers with optional country code, parentheses, and separators
Alternative Patterns
1. ^\d{10}$
2. ^\(\d{3}\) \d{3}-\d{4}$`
How to Use
1. The pattern above is preloaded—or enter your own 2. Add test strings to validate 3. See real-time match highlights 4. Copy the pattern for your code
Regex Quick Reference
| Symbol | Meaning | Example | ||
|---|---|---|---|---|
| \d | Any digit | \d{3} matches "123" | ||
| \w | Word character | \w+ matches "hello" | ||
| + | One or more | a+ matches "aaa" | ||
| * | Zero or more | a* matches "" or "aaa" | ||
| ? | Optional | colou?r matches "color" | ||
| ^ | Start of string | ^Hello | ||
| $ | End of string | world$ | ||
| [abc] | Character class | [aeiou] matches vowels | ||
| (a | b) | Alternation | (cat | dog) matches either |