Patrón regex para la validación de tarjetas bancarias

// NOTE: This is just example how could be done,
// real card validations have some additional rules.
// Please see source link for more details...

// A Visa card starts with 4 and has the length of 16 digits.
// A MasterCard starts with the numbers from 51 to 55, or the numbers 2221 to 2720. All have 16 digits.
// American Express card numbers start with 34 or 37 and have 15 digits.
String visaRegex = "^4[0-9]{15}";
String masterCardRegex = "5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|720[0-9]{12})";
String americanExpressRegex = "3[4-7][0-9]{13}";