I am really struggling with creating a Reg Ex for Julian Day that does not allow leading zeros.
I am using it for Input Validation using JavaScript Reg Ex. It needs to match 1 through 366.
Example Matches:
- 1
- 99
- 366
- 159
Example Match Failures:
- 01
- 001
- 099
- 367
- 999
- 0
I tried this on regex101:
^[1-9]|[1-9][0-9]|[1-3][0-5][0-9]|36[0-6]$
But for I am not getting the optional parts down right. So when I put in 266, I get a match on 2 and 66. (This issue is translating to my input validation control.)
I thought about trying to use +
for one or more, but I need to not allow leading zeros, so that does not work.
I have read the guidance on asking a RegEx question and tried to follow it, but if I missed something, please let me know and I will update my question.