AnyEvent-IRC
view release on metacpan or search on metacpan
lib/AnyEvent/IRC/Util.pm view on Meta::CPAN
}
=item B<filter_colors ($line)>
This function will filter out any mIRC colors and (most) ansi escape sequences.
Unfortunately the mIRC color coding will destroy improper colored numbers. So this
function may destroy the message in some occasions a bit.
=cut
sub filter_colors($) {
my ($line) = @_;
$line =~ s/\x1B\[.*?[\x00-\x1F\x40-\x7E]//g; # see ECMA-48 + advice by urxvt author
$line =~ s/\x03\d\d?(?:,\d\d?)?//g; # see http://www.mirc.co.uk/help/color.txt
$line =~ s/[\x03\x16\x02\x1f\x0f]//g; # see some undefined place :-)
$line
}
# implemented after the below CTCP spec, but
# doesnt seem to be used by anyone... so it's untested.
( run in 0.675 second using v1.01-cache-2.11-cpan-65fba6d93b7 )