I'm looking for a regular expression to match any of the following: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12
Normally I would just do [1-12]
but I need the padding of the zero if it is only one digit. Having a bit of a brainfart on how to do that elegantly.
You can use the following regex.
^0[1-9]|1[012]$
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments