Skip to content

Instantly share code, notes, and snippets.

@carloseduardosx
Last active May 24, 2018 20:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carloseduardosx/7ac12e6701d1974f1c8226272e999173 to your computer and use it in GitHub Desktop.
Save carloseduardosx/7ac12e6701d1974f1c8226272e999173 to your computer and use it in GitHub Desktop.
Regex for test BINs(Bank Identification Number)

This is a list of Regex to match BINs of some credit/debit card brands

American Express

Possible prefixes

  • 34
  • 37
/^3[47]/g

Aura

Possible prefixes

  • 50
/^50/g

Diners Club

Possible prefixes

  • 300-305
  • 309
  • 36
  • 38-39
/^(30[059])|(3[689])/g

Discover Card

Possible prefixes

  • 6011
  • 622126-622925
  • 644-649
  • 65
/^(6011|(62212[6-9]|6221[3-9][0-9]|622[2-8][0-9]{2}|6229[01][0-9]|62292[0-5])|64[4-9]|65)/g

Elo

Possible prefixes

  • 636368
  • 438935
  • 457393
  • 504175
  • 451416
  • 636297
  • 5067
  • 4576
  • 4011
  • 506699
  • 50904-50907
/^(4011|438935|451416|4576|457393|504175|506699|5067|5090[4-7]|636297|636368)/g

Hipercard

Possible prefixes

  • 384100
  • 384140
  • 384160
  • 606282
/^((606282)|(3841[046]0))/g

JCB

Possible prefixes

  • 3528-3589
/^(352[89]|35[3-8][0-9])/g

Mastercard

Possible prefixes

  • 51-55
  • 2221-2720
/^(5[1-5])|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)/g

Visa

Possible prefixes

  • 4
/^4/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment