Skip to content

Instantly share code, notes, and snippets.

@ibayazit
Created September 4, 2021 15:34
Show Gist options
  • Select an option

  • Save ibayazit/4c11e2db4a1a063a4046c49ceb9c5867 to your computer and use it in GitHub Desktop.

Select an option

Save ibayazit/4c11e2db4a1a063a4046c49ceb9c5867 to your computer and use it in GitHub Desktop.
Card number regexes
visa
4[0-9]{12}(?:[0-9]{3})?
mastercard
^5[1-5][0-9]{14}
american express
^3[47][0-9]{13}
diners club
^3(?:0[0-5]|[68][0-9])[0-9]{11}
discover
^6(?:011|5[0-9]{2})[0-9]{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