RegEx for value Range from 1 - 365

regex

Solution

Not really a good fit for regex, but if you insist:

^(?:36[0-5]|3[0-5][0-9]|[12][0-9][0-9]|[1-9][0-9]|[1-9])$

This is not allowing leading zeroes. If you wish to allow those, let me know.

The expression above can be shortened a little to

^(?:36[0-5]|3[0-5]\d|[12]\d{2}|[1-9]\d?)$

but I find the first solution to be a bit more readable. YMMV.

Problem

What is the RegEx for value Range from 1- 365

Original source