in reply to Munging Rendered HTML While Preserving Formatting
update: I should note that HTML::Tree doesn't preserve the formatting of its input exactly, but thats not implicitly a bad thing. To begin is as simple as
Hopefully that'll help you see the forest :)use strict; use warnings; use HTML::TreeBuilder; my $body = HTML::TreeBuilder->new_from_content( 'h<b>e</b>l<i>lo</i>!!!' )->find_by_tag_name('body'); if( $body->as_text =~ /hello!!!/ ){ print $_,$/ for $body->content_list; } __END__ h HTML::Element=HASH(0x1a540e0) l HTML::Element=HASH(0x1a54140) !!!
|
|---|