Using the HTML::Strip Perl extension
Stripping HTML/XML/SGML
Example demonstrating how to use the HTML::Strip Perl extension for stripping HTML markup from text.
The results may not perfectly remove all HTML depending on the complexity of your markup.
strips HTML-like markup from text in a very quick and brutal manner. You can also use the extension
to strip XML or SGML from text.
Code
#!/usr/bin/perl use HTML::Strip; $raw_html = '<h3 class="post-title">To Be, rather than to Seem</h3><div>Esse Quam Videre--- To Be, rather than to Seem</div>'; my $hs = HTML::Strip->new(); my $clean_text = $hs->parse( $raw_html ); $hs->eof; print "$clean_text";
Similar Content