It looks like you are using the wrong regular expression.
If you want to check the string for regular expression, you can use the method match()for the string:
string.match(regexp)
You are doing it wrong:
if ( regex.match($(this).val()) ) {
. :
if ( $(this).val().match(regex) ) {
, script :
ccMap.cards = {
'amex': /^3[47][0-9]{13}$/,
if ( regex.test($(this).val()) ) {