Regex pattern for numeric values

regex

I need an regular expression pattern to only accept positive whole numbers. It can also accept a single zero.

I do not want to accept decimals, negative number and numbers with leading zeros.

Any suggestions?

Best Solution

^(0|[1-9][0-9]*)$