c# - regular expression to accept only numbers within specific range -


i trying regular expression accept numbers , should not allow accept more ten

^[]0,10]{0,10}$ 

this matches range of numbers: [0-9]

^([0-9])$ 

and can use $1 if need replace else ...

or can use \d instead of [0-9] this:

^(\d)$ 

and if want accept 10, have use |. thing this;

^(\d|10)$ 

as said, ^ regex accept both range [0-9] , 10.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -