c# - Regular expression for 0 or a positive number -


i need regular expression check string's value either '0', or positive number length equal 1 10 (also first digit cannot zero).

i'm stuck, can 0, can't positive number.

here have:

(^([0])$)|(^([1-9][0-9]{0-9})$) 

this reg exp looks little crazy, i've been trying lot of different things , making more crazier , crazier.

for range of possibilities, use comma, not hyphen.

(^([0])$)|(^([1-9][0-9]{0,9})$) 

however, regex can shortened to:

^(0|[1-9][0-9]{0,9})$ 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -