]> Sergey Matveev's repositories - public-inbox.git/commitdiff
filter: clarify regular expression
authorEric Wong <e@80x24.org>
Fri, 11 Apr 2014 19:51:32 +0000 (19:51 +0000)
committerEric Wong <e@80x24.org>
Fri, 11 Apr 2014 22:24:30 +0000 (22:24 +0000)
I often forget the subtleties of Perl regexps and newlines,
so I suspect others do, too.  Use explicit capture so it's
more familiar to users of non-Perl regexps.

lib/PublicInbox/Filter.pm

index e5a8fafe52d66cd07fb06b73018c8b8cf3218d18..bd33130cdeb1fbdae27f019778a830acac7b232a 100644 (file)
@@ -93,7 +93,7 @@ sub dump_html {
        my $err = "";
 
        # be careful about remote command injection!
-       if ($charset =~ /\A[A-Za-z0-9\-]+\z/) {
+       if ($charset =~ /\A([A-Za-z0-9\-]+)\z/) {
                push @cmd, "-assume_charset=$charset";
        }
        if (IPC::Run::run(\@cmd, $body, \$out, \$err)) {