in reply to Extracting full links from HTML
use warnings; use strict; use HTML::TreeBuilder; my $str = "<a href ='some\\where'><img src='apple.gif'></img></a>"; my $root = HTML::TreeBuilder->new_from_content($str); for ($root->look_down ('_tag', 'a')) { next if ! $_->look_down ('_tag', 'img'); print $_->as_HTML (); }
which prints:
<a href="some\where"><img src="apple.gif"></a>
should get you started. Take a look at HTML::TreeBuilder and HTML::Element.
|
|---|