Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to use regular expressions in asp.net for geting only numerical value between 1-100... pls provide me the regular expression ...
Posted

Try this
CSS
^([0-9]|[0-9][0-9])$
 
Share this answer
 
Hi shinju

Following code solve your problem,
C#
string text = "123 plus 12 equal 135";
foreach (Match num in Regex.Matches(text, @"\d{1,3}"))
{
   int result = Convert.ToInt32(num.Value);
   if (result <=100)
        Console.WriteLine(result); // output : 12
}

--SJ
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900