- $search = '1' unless $pattern || $who;
- $search = "\$ref->[1] =~ /$pattern/" if $pattern;
- $search .= ' && ' if $pattern && $who;
- $search .= "(\$ref->[2] =~ /$who/ || \$ref->[3] =~ /$who/)" if $who;
+ if ($pattern) {
+ $search = "\$ref->[1] =~ m{^$pattern}i";
+ $hint = "m{$pattern}i";
+ }
+ if ($who) {
+ if ($search) {
+ $search .= ' && ';
+ $hint .= ' && ';
+ }
+ $search .= "(\$ref->[2] =~ m{$who}i || \$ref->[3] =~ m{$who}i)";
+ $hint .= 'm{$who}i';
+ }
+ $hint = "next unless $hint" if $hint;
+ $search = "1" unless $search;
+