Rule:
Visa
13 or 16 digits, starting with 4
MasterCard
16 digits,starting with 51 through 55
Discover
16 digits,starting with 6011 or 65
American Express
15 digits,starting with 34 or 37
Diners Club
14 digits,starting with 300 through 305,36 or 38
JCB
15 digits,starting with 2131 or 1800, or 16 digits starting with 35
(?x)^(?:
(?P<visa>4[0-9]{12}(?:[0-9]{3})?) |
(?P<mastercard>5[1-5][0-9]{14}) |
(?P<discover>6(?:011|5[0-9]{2})[0-9]{12}) |
(?P<amex>3[47][0-9]{13}) |
(?P<diners>3(?:0[0-5]|[68][0-9])[0-9]{11}) |
(?P<jcb>(?:2131|1800|35[0-9]{3})[0-9]{11})
)$
Python 正则表达式验证信用卡号码
最新推荐文章于 2024-06-07 16:03:08 发布