AG
Regex
AGREGEX
About
Cheat Sheet
Pattern Library
Guides
Contact
한국어
English
日本語
中文
Español
Português
Français
Deutsch
Русский
العربية
Bahasa Indonesia
← Pattern Library
PATTERN
Credit Card
Regex Pattern
Security · Validation
/
\b(?:\d[ -]*?){13,16}\b
/g
Copy
/\b(?:\d[ -]*?){13,16}\b/g
Security · Validation
Flags:
g
Description
Matches 13–16 digit credit card number shapes that may be separated by spaces or hyphens. It does not check real validity (the Luhn check); it is handy for finding and masking card-number shapes in documents.
Example Matches
4111 1111 1111 1111
5500-0000-0000-0004
Test String
Pay with card 4111 1111 1111 1111
Open this pattern in the tester
Other Patterns
Username
Strong Password
← Pattern Library