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.
^(?:[1-9]\d*|0)$
This is your pattern...
^(?:[1-9]\d*|0)$^[1-9]\d*|0$ should do the trick.(^[1-9]\d*)|(0$)!12abc or xyz0(?: ) Non-capturing parentheses group the regex so you can apply regex operators, but do not capture anything and do not create backreferences.