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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -