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.

2
  • 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. Commented Oct 11, 2016 at 13:21
  • You have to get rendered text? Try read this Commented Oct 11, 2016 at 13:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.