Regular expression to match 1 through 12 with padding?

John Smith

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.

hwnd

You can use the following regex.

^0[1-9]|1[012]$

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related