X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FBadWords.pm;h=446bcf1e4f06ca9996504bcbd3445971c27bde80;hb=6a5fdda14c1dccca4e002618cc8a428b1dc163bd;hp=09911b4ad5748bfde84a4e502aac9a823c044c48;hpb=606b9690c7bb9e293cb4a03507f0280eea05d9ce;p=spider.git diff --git a/perl/BadWords.pm b/perl/BadWords.pm index 09911b4a..446bcf1e 100644 --- a/perl/BadWords.pm +++ b/perl/BadWords.pm @@ -135,7 +135,7 @@ sub generate_regex my $res; @relist = sort {$a->[0] cmp $b->[0]} @relist; for (@relist) { - $res .= qq{(?:$_->[1]) |\n}; + $res .= qq{\\b(?:$_->[1]) |\n}; } $res =~ s/\s*\|\s*$//; $regex = qr/\b($res)/x; @@ -211,7 +211,7 @@ sub check if ($regex) { my %uniq; - @out = grep {++$uniq{$_}; $uniq{$_} == 1 ? $_ : undef }($s =~ /\b($regex)/g); + @out = grep {++$uniq{$_}; $uniq{$_} == 1 ? $_ : undef }($s =~ /($regex)/g); dbg("BadWords: check '$s' = '" . join(', ', @out) . "'") if isdbg('badword'); return @out; }