My question is NOT similiar to Regular expression to match numbers between 1-5000, because I have something else to check (no range, leading and no leading zeroes, etc.).
I have the following RegEx in an input check:
^[0-9]{1,4}$
This works for digits with 1-4 length.
Unfortunately I have to allow only these combinations:
- One digit numbers 1-9 (no leading zeroes)
- or two digits numbers 10-30 (no leading zeroes)
- or four digits numbers 0001-9999 (with leading zeroes).
What RegEx do I need?