Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(^4(?:\d?){3}\s?(?:\d?){4}\s?(?:\d?){4}(?:\s?\d?){7}$)|(^(?:5[1-5](?:\d?){2}\s?|222\d?\s?|22[3-9]\d?\s?|2[3-6](?:\d?){2}\s?|27[01]\d?\s?|2720\s?)(?:(?:\d?){4}\s?){2}(?:\d?){4}$)|(^3[47](?:\d?){2}\s?(?:(?:\d?){4}\s?(?:\d?){2}\s?(?:\d?){2}\s?)(?:\d?){3}$)|(^3(?:0[0-5]|[68]\d?)\d?\s?(?:(?:\d?){4}\s?(?:\d?){2}\s?(?:\d?){2}\s?)(?:\s?\d?){7}$)|(^6(?:011\s?|5(?:\d?){2}\s?)(?:(?:\d?){4}\s?){3}(?:\d?\s?){3}$)|(^(?:2131\s?|1800\s?|35(?:\d?){2}\s?\d?\s?)(?:\d?\s?){14}$)
/
gm
Input 1
4332 1234 1231 2312 333 5432 1234 1234 1234 3411 123412 34123 3051 123412 3412 6011 1234 1234 2012 3523 2342 2342 2342 333 Visa MasterCard Amex Diners Club Discover JCB This Regex is for predicting credit cards by the first few numbers. Try deleting numbers one by one to see it still get grabbed until its not sure. Spaces are also allowed in correct positions. https://en.wikipedia.org/wiki/Payment_card_number
Extraction
4332 1234 1231 2312 333 5432 1234 1234 1234 3411 123412 34123 3051 123412 3412 6011 1234 1234 2012 3523 2342 2342 2342 333 Visa MasterCard Amex Diners Club Discover JCB This Regex is for predicting credit cards by the first few numbers. Try deleting numbers one by one to see it still get grabbed until its not sure. Spaces are also allowed in correct positions. https://en.wikipedia.org/wiki/Payment_card_number