Back to Library
Validation

Credit Card (Simple)

Matches major credit cards (Visa, MasterCard, Amex, Discover).

Pattern
^(?: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})$

Test Cases

4111111111111111 Match
123 No Match

Try it Live

Test and customize this pattern in our interactive editor

Open in Editor