Regex – Need a simple RegEx to find a number in a single word

regex

I've got the following url route and i'm wanting to make sure that a segment of the route will only accept numbers. as such, i can provide some regex which checks the word.

/page/{currentPage}

so.. can someone give me a regex which matches when the word is a number (any int) greater than 0 (ie. 1 <-> int.max).

Best Solution

/^[1-9][0-9]*$/

Problems with other answers:

/([1-9][0-9]*)/ // Will match -1 and foo1bar
#[1-9]+# // Will not match 10, same problems as the first
[1-9] // Will only match one digit, same problems as first