Creditcard verification with regex?
What is the right way to verify a credit card with a regex? If which one to use there are tons online. If not how to verify? cletus How can I use credit card numbers containing spaces? covers everything you should need. See this link Finding or Verifying Credit Card Numbers with Regulars Expressions Visa: ^4[0-9]{12}(?:[0-9]{3})?$ All Visa card numbers start with a 4. New cards have 16 digits. Old cards have 13. MasterCard: ^5[1-5][0-9]{14}$ All MasterCard numbers start with the numbers 51 through 55. All have 16 digits. American Express: ^3[47][0-9]{13}$ American Express card numbers start