Matches major credit cards (Visa, MasterCard, Amex, Discover).
^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$
4111111111111111
123
Test and customize this pattern in our interactive editor