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>")))))
 
Back
Top