Here is an example regex to validate if a credit card expiry date is in the format mmyy
and is valid:
index.tsx502 chars14 lines
Explanation:
^(0[1-9]|1[0-2])\/?([0-9]{2})$
matches strings that start (^) with a valid month number (01 - 12) in the format m/
or mm/
(with or without a slash), followed by a two-digit year number within the range of 00 to 99 ($).gistlibby LogSnag