-
-
Save isocroft/072ea5e1f4d0d52eb034e7a6c93b5b76 to your computer and use it in GitHub Desktop.
| /* | |
| Modified with more card regexs | |
| See initial source: https://www.regular-expressions.info/creditcard.html | |
| */ | |
| let visa = /^4[0-9]{12}(?:[0-9]{3,4})?$/ | |
| let visa_local = /^4[19658][7684][0785][04278][128579](?:[0-9]{10})$/ | |
| let mastercard = /^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/ | |
| let mastercard_local = /^(?:5[13]99|55[35][19]|514[36])(?:11|4[10]|23|83|88)(?:[0-9]{10})$/ | |
| let verve = /^(?:50[067][180]|6500)(?:[0-9]{15})$/ | |
| let american_exp = /^3[47](?:[0-9]{13})$/ | |
| let diners_club = /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/ | |
| let maestro = /^(5899|5018|5020|5038|6304|6703|6708|6759|676[1-3])[06][19](?:[0-9]{10})$/ | |
| let discover = /^6(?:011|4[4-9]3|222|5[0-9]{2})[0-9]{12}$/ | |
| let laser = /^(6706|6771|6709)[0-9]{11,15}$/ | |
| let hipercard = /^(384100|384140|384160|606282|637095|637568|60(?!11))/ | |
| let jcb = /^(?:2131|1800|35\d{3})\d{11}$/ | |
Hello @ManeendraNath , can you get me 6 sample Rupay Card numbers ?
Maybe i can help
Hey @isocroft Thanks for this. Any chance you can give a little hint on how you came up with these regexes?
Thanks for this. I'll definitely check it out and add more to the cards in my project.
Sure thing @immatobi.
Remember mastercard_local, visa_local and verve are for only Naira debit/credit cards.
mastercard and visa e.t.c are for foreign currency debit/credit cards.
Implemented in python ππΎππΎππΎ
"""
Modified with more card regexs
See initial source: https://www.regular-expressions.info/creditcard.html
"""
visa = re.compile(r"^4[0-9]{12}(?:[0-9]{3,4})")
visa_local = re.compile(r"^4[19658][7684][0785][04278][128579](?:[0-9]{10})")
mastercard = re.compile(r"^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}")
mastercard_local = re.compile(r"^(?:5[13]99|55[35][19]|514[36])(?:11|4[10]|23|83|88)(?:[0-9]{10})")
verve = re.compile(r"^(?:50[067][180]|6500)(?:[0-9]{15})")
american_express = re.compile(r"^3[47](?:[0-9]{13})")
diners_club = re.compile(r"^3(?:0[0-5]|[68][0-9])[0-9]{11}")
maestro = re.compile(r"^(5899|5018|5020|5038|6304|6703|6708|6759|676[1-3])[06][19](?:[0-9]{10})")
discover = re.compile(r"^6(?:011|4[4-9]3|222|5[0-9]{2})[0-9]{12}")
laser = re.compile(r"^(6706|6771|6709)[0-9]{11,15}")
hipercard = re.compile(r"^(384100|384140|384160|606282|637095|637568|60(?!11))")
jcb = re.compile(r"^(?:2131|1800|35\d{3})\d{11}")Sure thing @immatobi.
Remember
mastercard_local,visa_localandverveare for only Naira debit/credit cards.
mastercardandvisae.t.c are for foreign currency debit/credit cards.
Yes, got it
Implemented in python ππΎππΎππΎ
""" Modified with more card regexs See initial source: https://www.regular-expressions.info/creditcard.html """ visa = re.compile(r"^4[0-9]{12}(?:[0-9]{3,4})") visa_local = re.compile(r"^4[19658][7684][0785][04278][128579](?:[0-9]{10})") mastercard = re.compile(r"^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}") mastercard_local = re.compile(r"^(?:5[13]99|55[35][19]|514[36])(?:11|4[10]|23|83|88)(?:[0-9]{10})") verve = re.compile(r"^(?:50[067][180]|6500)(?:[0-9]{15})") american_express = re.compile(r"^3[47](?:[0-9]{13})") diners_club = re.compile(r"^3(?:0[0-5]|[68][0-9])[0-9]{11}") maestro = re.compile(r"^(5899|5018|5020|5038|6304|6703|6708|6759|676[1-3])[06][19](?:[0-9]{10})") discover = re.compile(r"^6(?:011|4[4-9]3|222|5[0-9]{2})[0-9]{12}") laser = re.compile(r"^(6706|6771|6709)[0-9]{11,15}") hipercard = re.compile(r"^(384100|384140|384160|606282|637095|637568|60(?!11))") jcb = re.compile(r"^(?:2131|1800|35\d{3})\d{11}")
Made a change here?
No @immatobi , i didn't
Regex for Rupay Debit and Credit Card is not available in the list.