Created
August 24, 2016 17:55
-
-
Save mikeyb/6e39a9a58d0ec20cae9a4419fc2a3d02 to your computer and use it in GitHub Desktop.
ccregex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (cardNumberValue.match(/^((?:222\d{1})\d{12}|(?:22[3-9])\d{13}|(?:2[3-6])\d{14}|(?:27[1])\d{13}|(?:2720)\d{12}|(?:5[1-5])\d{14})$/)) { | |
return mastercardAccepted; | |
} else if(cardNumberValue.match(/^4(\d{12}|\d{15})$/)) { | |
return visaAccepted; | |
} else if(cardNumberValue.match(/^(?:3[47])\d{13}$/)) { | |
return amexAccepted; | |
} else if(cardNumberValue.match(/^((?:65)\d{12}|(?:64[4-9])\d{11}|(?:6011)\d{10})$/)) { | |
return discoverAccepted; | |
} else if(cardNumberValue.match(/^(?:352[8-9])\d{11,12}|(?:35[3-8])\d{12,13}|(?:2131)\d{11}|(?:1800)\d{11}$/)) { | |
return jcbAccepted; | |
} else if(cardNumberValue.match(/^((?:30[0-5])\d{11}|(?:3[68])\d{12})$/)) { | |
return dinersclubAccepted; | |
} else if(cardNumberValue.match(/^((?:50[023456789]|62[179]|67[0-7]|60[2-5]|679)\d{9,16}|(?:501[0-8]|601[023456789]|676[0-9]|6771|6060|6304|6390)\d{8,15}|(?:5[6-9])\d{10,17})$/)) { | |
return maestroAccepted; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment