Reg Ex Search c#
Posted on 2011-02-14
I am new to regular expressions. I am doing search in text of HTML. What I want to do is find a tag then from that point find the next "</div>" tag
I have this
String body = sb.ToString();
String Start = "<div><a class=\"resultName\"";
String Stop = "</div>";
m = new Regex(Start, RegexOptions.Singleline | RegexOptions.IgnoreCase).Match(body);
int i = m.Index;
now find from i how many characters away is Stop "</div>"
so instead of somethikng like this
txtList.Text = body.Substring(i, 200);
But what I would like to do is txtList.Text = body.Substring(i, x);
Where x is the number of characters to the next "</div>"
Hope that was expained well