Regular Expressions 101

Community Patterns

13-16 digit credit card

1

Regular Expression
PCRE2 (PHP >=7.3)

/
(?:\d[ -]*?){13,16}
/
gm

Description

Finds a number that is 13-16 digits long. Can have spaces or hyphens in between the numbers and will still be found.

Submitted by Spencer Curtis - 2 years ago (Last modified 2 years ago)