1

I know how to search the body or the page source of the website using regex. However I want a result similar to browsers like firefox and chrome when you press ctrl F.

My current code.

    Dim search As String = txtsearch.Text.ToLower
    Dim target As String = web1.DocumentText.ToLower
    Dim counter As Integer = 0
    Dim m As Match = Regex.Match(target, search)

    Do While m.Success
        counter = counter + 1
        m = m.NextMatch()
    Loop

I'm currently using a WebBrowser and the code above will execute when the document completed.

Just an additional info. Searching the body or page source of the website will give a huge return. Example if I search the word "youtube" on youtube's body/page source I will get 40+ while if I do a ctrl f the result will be around 6 or less.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
realNewbie
  • 11
  • 4
  • In order to do this, you need to be able to parse the HTML to build the entire DOM, apply all the css styles, and then run javascript. That's how chorme and firefox do it. In other words, you need a web browser. – Joel Coehoorn Oct 11 '16 at 13:21
  • You have to get rendered text? Try [read this](http://stackoverflow.com/questions/14847656/get-the-final-generated-html-source-using-c-sharp-or-vb-net) – Andrea Oct 11 '16 at 13:21

0 Answers0