Regex for Positive integer

Matches a positive whole number with no leading zero.

^[1-9]\d*$

Proof it works

5/5 sample tests passed · compiles: true

SampleShould matchResult
42 yes pass
1000 yes pass
0 no pass
-5 no pass
01 no pass

Try your own input

Related patterns