Link to home
Start Free TrialLog in
Avatar of Charles Baldo
Charles BaldoFlag for United States of America

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).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

Thanks


Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Can't u use bodymsubstring(i,body.indexOf("<div>"))
Sry shd be body.Substring....
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial