With respect to previous question on SO, I raised an issue on active_merchant github issues on found that I had to change the regex to validate the card from JCB.
Now the question is where do I find the changed or updated IIN if they really are ? This wikipedia article shows the IIN range for JCB as 3528-3589
.
But the test card number I got from Authorize.net is 3088000000000017
. But this card number does not fall in the range specified by wikipedia.
So my questions
My advice is to apply the loosest validation possible if there is no compelling reason to know the card scheme; Fall back if necessary based on the first digit only. (Particularly if transactions are rejected based on IIN/BIN data sourced from Wikipedia ...)
For example in your linked validation scheme all Diners cards are assumed to begin 6011 - there are other ranges.
I don't know what Ruby's RE engine is but does
/^4[0-9]{12}([0-9]{3})?$/
actually match a 19 digit PAN? (It must).FWIW I use the (UK Centric): http://www.barclaycard.co.uk/business/files/Ranges_and_Rules_September_2014.pdf