Javascript regex for integer only, not to start with 0 but allow 0

javascript, regex

Solution

 ^(?:[1-9]\d*|0)$

This is your pattern...

Problem

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.

Original source