I have to validate for zero values in my text field, the length of text field is 4 chrs.
If the user enters 0 or 00 or 000 or 0000. this should fail.
presently i have written exp to validate values below 7500 which will also accept 0000.
please help me to tweek this to fail for 0 or 00 or 000 or 0000 values.
/^0*([0-9]{1,3}|[1-6][0-9]{3}|7[0-4][0-9]{2}|7500)$/
Thanks Punith
Explanation:
If you want to allow leading zeroes, then you can add
0*right after the^. But then the length restriction to four digits is lost, of course.