To match 3 or 4 digits, use the following regular expression:
/^[0-9]{3,4}$/
Explanation:
^: Start of string anchor[0-9]: Digit between 0 and 9 (you could also use\dhere){3,4}: A quantifier meaning between 3 and 4.$: End of string anchor
To match 3 or 4 digits, use the following regular expression:
/^[0-9]{3,4}$/
Explanation:
^: Start of string anchor[0-9]: Digit between 0 and 9 (you could also use \d here){3,4}: A quantifier meaning between 3 and 4.$: End of string anchor