projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove automatic [I1] and [O0] creation in regexes
[spider.git]
/
perl
/
BadWords.pm
diff --git
a/perl/BadWords.pm
b/perl/BadWords.pm
index 36db8ffba44384d76a3bc8acbc9789d0447cbbef..db33d7a1c4ebaeb34127c79bb1f5c1463dc35463 100644
(file)
--- a/
perl/BadWords.pm
+++ b/
perl/BadWords.pm
@@
-74,7
+74,7
@@
sub create_regex
# create a closure for each word so that it matches stuff with spaces/punctuation
# and repeated characters in it
my $w = uc $_;
# create a closure for each word so that it matches stuff with spaces/punctuation
# and repeated characters in it
my $w = uc $_;
- my @l =
map { $_ eq 'I' ? '[I1]' : ($_ eq 'O' ? '[O0]' : $_) }
split //, $w;
+ my @l = split //, $w;
my $e = join '+[\s\W]+', @l;
my $s = eval qq{sub { return \$_[0] =~ /$e+/ ? '$w' : () } };
push @regex, $s unless $@;
my $e = join '+[\s\W]+', @l;
my $s = eval qq{sub { return \$_[0] =~ /$e+/ ? '$w' : () } };
push @regex, $s unless $@;
@@
-104,8
+104,6
@@
sub check
return @out if @out;
for (split(/\s+/, $s)) {
return @out if @out;
for (split(/\s+/, $s)) {
- s/[^\w]//g;
- push @out, $_ if $badword->in($_);
s/\'?S$//;
push @out, $_ if $badword->in($_);
}
s/\'?S$//;
push @out, $_ if $badword->in($_);
}