I have write own regex to detect is it mmyy
or mm-yy
format:
^((0[1-9])|(1[0-2]))[\/\.\-]*((2[0-9])|([0-9]))$
Problem is this regex validates this wrong format: 036
.
How to fit it?
CodePudding user response:
The pattern mm-yy
and mmyy
can be matched by the following regular expression (assuming yy
can be from 00
to 99
):
^(0[1-9]|1[0-2])[/.-]?([0-9]{2})$