Try this:
/^[2-9]|[1-9][0-9]{1,3}$/
To implement your first condition:
- String should not be number less than 2 and not bigger than 9999 (2-9999)
There is two cases:
- Single digits : [2-9]This is a single character in the range between 2 and 9.
- Multiple digits: [1-9][0-9]{1,3}This is a two-three-four-digit number which all digits are in the range1and9.
Note1: {1,3} limits second character class to just accept one or two or three digits.
Note2: ^ means start of string and $ means end of string.
By the way, your second condition isn't defined in pattern above at all. (I mean it doesn't match any number which stars with 0, So all fine.)