I need a regular expression to validate credit card expiry date. Note that the format of the "date" is MM/YY where YY is the year without century and MM is the month (from 01 to 12). I do not need the YY to be in some limited range but only the MM. Thank you in advance.
This regexp does the job:
(0[1-9]|1[0-2])/[0-9]{2}
Note that it has a capturing group, depending on your regexp engine you can make it non-capturing like this:
(?:0[1-9]|1[0-2])/[0-9]{2}
2.1m questions
2.1m answers
60 comments
57.0k users