Skip to content

Instantly share code, notes, and snippets.

@censuradho
Created October 9, 2024 17:30
Show Gist options
  • Save censuradho/32e106fe66a6068c80cf9c73ccb62dd6 to your computer and use it in GitHub Desktop.
Save censuradho/32e106fe66a6068c80cf9c73ccb62dd6 to your computer and use it in GitHub Desktop.

Revisions

  1. censuradho created this gist Oct 9, 2024.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    const cards = {
    visa : /^4[0-9]{12}(?:[0-9]{3})/,
    mastercard : /^5[1-5][0-9]{14}/,
    diners : /^3(?:0[0-5]|[68][0-9])[0-9]{11}/,
    amex : /^3[47][0-9]{13}/,
    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}/,
    aura : /^(5078\d{2})(\d{2})(\d{11})$/
    };