Skip to content

Instantly share code, notes, and snippets.

@quinhone
Forked from gusribeiro/iin_card
Created July 16, 2019 19:48
Show Gist options
  • Save quinhone/e94e4cfdc235647b17ff9626530cd3f6 to your computer and use it in GitHub Desktop.
Save quinhone/e94e4cfdc235647b17ff9626530cd3f6 to your computer and use it in GitHub Desktop.
Regex para identificar bandeiras do cartão de crédito
Amex: /^3[47][0-9]{13}/
Diners Club: /^3(?:0[0-5]|[68][0-9])[0-9]{11}/
Visa: /^4[0-9]{12}(?:[0-9]{3})/
Mastercard: /^5[1-5][0-9]{14}/
Discover: /^6(?:011|5[0-9]{2})[0-9]{12}/
Hipercard: /^(606282\d{10}(\d{3})?)|(3841\d{15})/
Elo: /^((((636368)|(438935)|(504175)|(451416)|(636297))\d{0,10})|((5067)|(4576)|(4011))\d{0,12})/
JCB: /^(?:2131|1800|35\d{3})\d{11}/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment