i have a string like strValue = ID=\"Literal1"\" Text=\"This is example"....
now from above string i want to take first occurence of number i.e my output shuold be 1...
can anyone help me?
thx in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vijay YadavPosted Mar 2, 2011, 6:05 AM
Try this:-
using System.Text.RegularExpressions;
Regex re = new Regex(@"\d+");
Match m = re.Match(strValue);
if (m.Success)
string num= m.Value;
VulpesPosted Mar 2, 2011, 12:15 PM
Vijay YadavPosted Mar 2, 2011, 6:27 AM
Welcome!
Amruta KirdatPosted Mar 2, 2011, 6:21 AM
this is working...thx for ur reply...