S
S
Sergey Miller2021-06-23 00:02:42
JavaScript
Sergey Miller, 2021-06-23 00:02:42

Regular expression for MIR card number?

Hello. Help me write a regular expression, please.

I'm trying to determine if this is a map of the world by the first digits

if (num.match(/^(5[1-5]|222[1-9]|22[3-9]|2[3-6]|27[01]|2720)[0-9]{0,}$/)) {

return  alert('MasterCard');

} else if (num.match(/^4[0-9]{0,}$/) || num.match(/^4\d{12}/)) {

return alert('Visa');

} else if (num.match(/^(5[06789]|6)[0-9]{0,}$/) || num.match(/^4\d{12}/)) {

return alert('Maestro');


It is necessary for the MIR map, which starts (as Google said) with 2200 and 2204. How to write a regular season?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2021-06-23
@blackseabreathe

220(0|4)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question