+ }
+ push @out, create_regex();
+ return @out;
+}
+
+sub create_regex
+{
+ my @out;
+ @regex = ();
+
+ my $fh = new IO::File $regex;
+
+ if ($fh) {
+ while (<$fh>) {
+ chomp;
+ next if /^\s*\#/;
+ my @list = split " ";
+ for (@list) {
+ # create a closure for each word so that it matches stuff with spaces/punctuation
+ # and repeated characters in it
+ my $w = uc $_;
+ my @l = split //, $w;
+ my $e = join '+[\s\W]+', @l;
+ my $s = eval qq{sub { return \$_[0] =~ /$e+/ ? '$w' : () } };
+ push @regex, $s unless $@;
+ dbg("create_regex: $@") if $@;
+ }
+ }
+ $fh->close;