Charles Baldo
asked on
Reg Ex Search c#
Hi
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>";
Match m;
m = new Regex(Start, RegexOptions.Singleline | RegexOptions.IgnoreCase).M atch(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
Thanks
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>";
Match m;
m = new Regex(Start, RegexOptions.Singleline | RegexOptions.IgnoreCase).M
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
Thanks
Can't u use bodymsubstring(i,body.inde xOf("<div> "))
Sry shd be body.Substring....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.