Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
^4[0-9]{12}(?:[0-9]{3})?$
/
gm

Description

Validate if card number is Visa card. Update the first digit to make it Master card.

http://premiumpig.com

Submitted by Simon - 7 years ago