Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})
/
g

Description

Captures credit card looking sequence of digits Luhn validation remains required as a complement.

Submitted by OP - 10 years ago