Aitextcleaner-FormattingResidue
view release on metacpan or search on metacpan
lib/Aitextcleaner/FormattingResidue.pm view on Meta::CPAN
use strict;
use warnings;
use Exporter qw(import);
our $VERSION = '0.2.0';
our @EXPORT_OK = qw(clean_formatting_residue);
sub clean_formatting_residue {
my ($text) = @_;
die 'text must be a string' if !defined($text) || ref($text);
$text =~ s{</?(?:address|article|blockquote|br|div|li|p|pre|section)\b[^>]*>}{\n}gi;
$text =~ s{<[^>]*>}{}g;
$text =~ s/&/\&/g;
$text =~ s/</</g;
$text =~ s/>/>/g;
$text =~ s/"/"/g;
$text =~ s/'|'/'/g;
$text =~ s/ / /g;
$text =~ s/â/"/g;
$text =~ s/â/"/g;
$text =~ s/â/'/g;
( run in 0.491 second using v1.01-cache-2.11-cpan-d01c6094234 )