^(?: (?<visa>4[0-9]{12}(?:[0-9]{3})?) |
(?<mastercard>5[1-5][0-9]{14}) |
(?<discover>6(?:011|5[0-9]{2})[0-9]{12}) | (?<amex>3[47][0-9]{13}) |
(?<diners>3(?:0[0-5]|[68][0-9])[0-9]{11}) | (?<jcb>(?:2131|1800|35[0-9]{3})[0-9]{11}) )$
Some Regex don't support name capture - so I tried this as well:
^(?: (4[0-9]{12}(?:[0-9]{3})?) | # Visa
(5[1-5][0-9]{14}) | # MasterCard
(6(?:011|5[0-9]{2})[0-9]{12}) | # Discover
(3[47][0-9]{13}) | # AMEX
(3(?:0[0-5]|[68][0-9])[0-9]{11}) | # Diners Club
((?:2131|1800|35[0-9]{3})[0-9]{11}) # JCB )$
With no luck.
2 件の回答

Hi Lynn,
I wanted to check if you got this fixed. If yes, may I suggest that you can share the solution here so other community members can also get help if they come across similar question.
Thanks,