#!/usr/bin/perl use warnings; use strict; use HTML::TokeParser::Simple; my $html = do{local $/; <DATA>}; my $p = HTML::TokeParser::Simple->new(\$html); while (my $t = $p->get_token){ next if $t->is_tag(q{font}); print $t->as_is; } __DATA__ <p><font face="Verdana">one <a href="link.html">two</a> three</font></ +p>
How would you go about this using HTML::TreeBuilder? The closest I've got replaces everything between font tags with content (text) zapping any tags.<p>one <a href="link.html">two</a> three</p>
#!/usr/bin/perl use warnings; use strict; use HTML::TreeBuilder; my $html = do{local $/; <DATA>}; my $h = HTML::TreeBuilder->new_from_content($html); my $para = $h->look_down(_tag => q{p}); my $font = $para->look_down(_tag => q{font}); $font->replace_with($font->as_text); print $para->as_HTML; __DATA__ <p><font face="Verdana">one <a href="link.html">two</a> three</font></ +p>
<p>one two three
In reply to Removing font tags using HTML::TreeBuilder by wfsp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |