Home All Groups Group Topic Archive Search About

Parsing a string that contains HTML ?

Author
11 Jul 2006 1:26 PM
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

Author
11 Jul 2006 1:43 PM
Sanjib Biswas
Dim Str As String = "<html><body>hi there</body></html>"

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

"Erland" <Erland.Erik***@gmail.com> wrote in message
news:1152624414.045853.87650@p79g2000cwp.googlegroups.com...
> 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
>