By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

Parsing HTML String for Controls

P: n/a
Is there an existing function that will take a string (HTML RESPONSE) and
look through it for specific HTML Tags. I am looking to parse web responses
for <IMG> tags to see if the tag has an ALT property.

I know I can do it by hand, but I thought there may be something to do it
already.

Thanks!!

Kevin
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"kdub" <kd**@microsoft.com> wrote in
news:#T**************@TK2MSFTNGP12.phx.gbl:
Is there an existing function that will take a string (HTML
RESPONSE) and look through it for specific HTML Tags. I am
looking to parse web responses for <IMG> tags to see if the tag
has an ALT property.

I know I can do it by hand, but I thought there may be something
to do it already.


Kevin,

You can use regular expressions to pick out all of the IMG elements
that have an ALT attribute:

<img.*?alt\s?=\s?("|')(?<alt_text>.*?)("|').*?>
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.