I need a regex to validate integer numbers. 05 and 00
are not allowed but 0
is allowed.
Currently I have this:
/^[1-9]\d*$/
But it does not allow 0
. Thanks for help.
I need a regex to validate integer numbers. 05 and 00
are not allowed but 0
is allowed.
Currently I have this:
/^[1-9]\d*$/
But it does not allow 0
. Thanks for help.
2 Answers
Reset to default 12 ^(?:[1-9]\d*|0)$
This is your pattern...
Your regex should be ^(?!0.)\d+$