Bug#601251: perl: /x modifier doesn't seem to make regex completely whitespace-insensitive

Niko Tyni ntyni at debian.org
Mon Oct 25 08:32:56 UTC 2010


On Sun, Oct 24, 2010 at 09:49:05AM -0700, Britton Leo Kerin wrote:
> Package: perl
> Version: 5.10.0-19lenny2
> Severity: normal

> Given: 
> 
>      $tdl = 'dir       call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
>      ' 
> 
> This doesn't die:
> 
>      $tdl =~ s/^( augroup | buffer | command | dir | environment | event |
>                   expression | file | shellcmd | function | help |
>                   highlight | mapping | menu | option | tag |
>                   tag_listfiles | var | custom | customlist ) \s+
>                 (.*)
>               /
>                $2/x or die "foo";
> 
> But this does:
> 
>      $tdl =~ s/^( augroup | buffer | command | dir | environment | event |
>                   expression | file | shellcmd | function | help |
>                   highlight | mapping | menu | option | tag |
>                   tag_listfiles | var | custom | customlist ) 
>                         \s+
>                 (.*)
>               /
>                $2/x or die "foo";
> 
> The only different is the \s+ is on a line by itself in the second case.

I can't quite reproduce this. As far as I can see, both of the
substitutions succeed (don't die) on the original string, but if applied
in the order you gave, the second one fails because the first one has
changed the string.

Could you please supply a test script as an attachment, and preferably
trim irrelevant parts to make it easier to see the actual problem? It's
possible that your inlining has broken some whitespace and hidden
the issue.
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list