Parsing a string that contains HTML ?

  • Thread starter Thread starter Erland
  • Start date Start date
E

Erland

Hi all,

I have a string variable that contains HTML such as
str = "<html><body>hi there</body></html>"
now from above string variable I want to retreive the string between
<body> and </body> tags. Can anybody please enlighten me as to how can
I solve this problem. Any help and insights will be appreciated.
Thank you for your help and time in advance.

-Erland
 
Dim Str As String = "<html><body>hi there</body></html>"

Dim body = Str.Substring((Str.IndexOf("<body>") + Len("<body>")),
((Str.IndexOf("</body>") - (Str.IndexOf("<body>") + Len("<body>")))))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top