Parsing HTML String for Controls

  • Thread starter Thread starter kdub
  • Start date Start date
K

kdub

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
 
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.
 
Back
Top