Regular Expressions 101

Community Patterns

Find CC numbers in a string

0

Regular Expression
PCRE (PHP <7.3)

/
(?:^|.*[^0-9])[0-9]{16}(?:$|[^0-9].*$)
/
g

Description

Test on the most basic possible form of credit card numbers.

Submitted by Xtina - 7 years ago