Regex for American Express Card
Regex Pattern
^3[47][0-9]{13}$Amex — 15 digits starting with 34 or 37
Quick Answer
The regex pattern for american express card is `^3[47][0-9]{13}$`. Amex — 15 digits starting with 34 or 37. This works in JavaScript, Python, Ruby, PHP, Java, and most regex engines that support PCRE syntax.
Test Examples
| Input | Result |
|---|---|
| 378282246310005 | ✓ Matches |
| 371449635398431 | ✓ Matches |
| 4111111111111111 | ✗ No match |
| 3782822463100 | ✗ No match |
| 3512345678901234 | ✗ No match |
Code Examples
javascript
const regex = /^3[47][0-9]{13}$/;
const isValid = regex.test(value);python
import re
pattern = r'^3[47][0-9]{13}$'
if re.match(pattern, value):
print("valid")ruby
pattern = /^3[47][0-9]{13}$/
if value =~ pattern
puts "valid"
endphp
if (preg_match('/^3[47][0-9]{13}$/', $value)) {
echo "valid";
}java
String pattern = "^3[47][0-9]{13}$";
boolean isValid = value.matches(pattern);Frequently Asked Questions
Related Regex Patterns
Visa Credit Card
Visa card — starts with 4, 13 or 16 digits total
Mastercard Credit Card
Mastercard — 16 digits starting with 51-55 or 2221-2720
Any Credit Card
Visa, Mastercard, Amex, Discover, Diners
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