Connecting Tech Pros Worldwide Forums | Help | Site Map

get value from html string over regular expression

td1369
Guest
 
Posts: n/a
#1: Nov 20 '05
hello,

i have a string that contains the html code of a html-page.

Very important is to know that in the page is a single image. That url i
want to read from the page.

I want to get the url of the image and the content of a "<p"> with a
dedicated classe name (for ex. <p class="descr"> ..."

Example - string variable with url-content - i show only a part of the
content.
vMyHtmlString=".......<TR><TD colspan="2"><img
src='/image/myimages.asp?id=I368' align=LEFT></TD>
<TD VALIGN=TOP><p class=descr>Adobe Acrobat ....</p></TD>
</TR></TABLE></P>...."

I want to get the values:
-> /image/myimages.asp?id=I368
and the content from "<p class... </p>"
-> Adobe Acrobat ....
Adobe Acrobat ....

thanks

Kevin Spencer
Guest
 
Posts: n/a
#2: Nov 20 '05

re: get value from html string over regular expression


This one will give you the "src" - afraid I have no time to do the other
right now. I'll be back in a week!

(?i)(?s)(<img)??(?<!\1)src=["]?([^\s"]*)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition

"td1369" <td1369@discussions.microsoft.com> wrote in message
news:29D045FE-928D-4B5A-A70E-F05F96B28A18@microsoft.com...[color=blue]
> hello,
>
> i have a string that contains the html code of a html-page.
>
> Very important is to know that in the page is a single image. That url i
> want to read from the page.
>
> I want to get the url of the image and the content of a "<p"> with a
> dedicated classe name (for ex. <p class="descr"> ..."
>
> Example - string variable with url-content - i show only a part of the
> content.
> vMyHtmlString=".......<TR><TD colspan="2"><img
> src='/image/myimages.asp?id=I368' align=LEFT></TD>
> <TD VALIGN=TOP><p class=descr>Adobe Acrobat ....</p></TD>
> </TR></TABLE></P>...."
>
> I want to get the values:
> -> /image/myimages.asp?id=I368
> and the content from "<p class... </p>"
> -> Adobe Acrobat ....
> Adobe Acrobat ....
>
> thanks[/color]


Closed Thread