Creditcard verification with regex?

前端 未结 5 1055
星月不相逢
星月不相逢 2021-02-09 10:58

What is the right way to verify a credit card with a regex? If which one to use there are tons online. If not how to verify?

5条回答
  •  被撕碎了的回忆
    2021-02-09 11:09

    -- Edit:

    Infact, I'll slightly disagree with myself and agree with cletus. Validate as much as you can (without getting into details of specific types of credit cards [IMHO]) before sending it on. And it goes without saying (hopefully), that this validation should be done in JavaScript, to make it fast, then on the server, to double check (and for JavaScript disabled people).

    -- Previous Response:

    Don't bother; just let the provider verify it when you actually attempt payment. No legitimate reason to try and verify it yourself. You can use this though, if you really feel like it.

提交回复
热议问题