Regex for US Phone Number
Regex Pattern
^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$US phone number in common formats
Quick Answer
The regex pattern for us phone number is `^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$`. US phone number in common formats. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.
Test Examples
| Input | Result |
|---|---|
| (555) 123-4567 | ✓ Matches |
| 555-123-4567 | ✓ Matches |
| 5551234567 | ✓ Matches |
| 555.123.4567 | ✓ Matches |
| 555-12-34567 | ✗ No match |
| +1 555 123 4567 | ✗ No match |
| 123-456 | ✗ No match |
Code Examples
javascript
const regex = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;
const isValid = regex.test(value);python
import re
pattern = r'^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$'
if re.match(pattern, value):
print("valid")ruby
pattern = /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/
if value =~ pattern
puts "valid"
endphp
if (preg_match('/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/', $value)) {
echo "valid";
}java
String pattern = "^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$";
boolean isValid = value.matches(pattern);Frequently Asked Questions
Related Regex Patterns
International Phone (E.164)
Validates E.164 international format — + followed by 2-15 digits
Indian Phone Number
Indian mobile number with optional +91 country code
UK Phone Number
UK mobile number with optional +44 country code
Email Address
Validates a standard email address format
Email (RFC 5322 Compliant)
RFC 5322 compliant email validation with label length limits
URL (HTTP/HTTPS)
Validates HTTP and HTTPS URLs