so i just learned regex today and we didn't get to these symbols /s ^ $
the reason im asking is, firstly i want to know, but i was tasked with writing a regex for all active and common credit cards and the issue i was stuck on is that american express cards have 1 digit less. and didn't know how to write the Regex so that only when the first two digits are 37 (which is American express only) a 15 digit total is allowed.
then i found this:
^((4\d{3})|(5[1-5]\d{2})|(6011)|(34\d{1})|(37\d{1}))-?\s?\d{4}-?\s?\d{4}-?\s?\d{4}|3[4,7][\d\s-]{15}$
and if i take a WORKING CC from Visa lets say (16 digits) and subtract one, it doesn't work, but 15 digits DO WORK with American express, can anyone explain what in the regex does that?