-1

This is my html:

<div class="bla">
followers
<a href="">followers count </a>
</div>

What i want is that, if <div class="bla" /> inside text equals followers get next a tag inside text(followers count). I know this would be easy with htmlagilitypack but in this case can't use it. How to do it with regex?

1 Answers1

1

Is this what you need?

    var mtch = Regex.Match(input, 
"<div class[ ]?=[ ]?\"bla[^\"]*\"[ ]?>(?<groupName>[\\w\\W]+</div>");
    if (mtch.Groups["groupName"].Value.ToLower().Contains("followers"))
    {
        //do your stuff
    }
Mikhail Tulubaev
  • 4,141
  • 19
  • 31