I need to do regex for these credit cards in the PHP. •Visa cards have 16 digits and start with a 4 •MasterCard have 16 digits and start with digits 51through to55 •American Express has 15 digits and starts with 34or37.
/^(51|52|53|54|55)\d+/
^((?<VISA>4\d{15})|(?<MC>5[1-5]\d{14})|(?<AMEX>3[47]\d{13}))$
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)