CC: | kencotterill [...] netspace.net.au |
Subject: | Cosmetic Bug in Regexp::Debugger output |
G'day Damian,
'Regexp::Debugger' was mentioned on PerlMonks CB today: I checked it out
and loved what I saw. I found a minor cosmetic bug - described below.
There's a presentational bug in the output of captured matches when the
number of matches exceeds 9. For 1 to 9 matches, I get:
$1 = ...
$2 = ...
...
$9 = ...
For more than 9 matches, I start seeing:
$1 = ...
$10 = ...
$11 = ...
$2 = ...
Using the '-' key, I can go back back to:
$1 = ...
$10 = ...
...
$9 = ...
and
$1 = ...
...
$9 = ...
From here, I can use the step key (s) to get back to the same order as
shown above ($1, $10, $11, ..., $2).
I find no issue with the functionality, just the presentation of results.
Here's a minimal example to show the problem:
--- code ---
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use Regexp::Debugger;
my $re = qr{ \A ( a ) \s ( b ) \s ( c ) \s ( d ) \s ( e ) \s ( f ) \s
( g ) \s ( h ) \s ( i ) \s ( j ) \s ( k ) \z }x;
my $x = q{a b c d e f g h i j k};
$x =~ m{$re};
Show quoted text
--- end code ---
A more complex example, where I first encountered this issue, is:
--- code ---
my $re = qr{
\A
REMOTE \s+
\[ ( [^]]+ ) \] \s+
( @@ ) \s+
( \[ [^]]+ \] ) \s+
( \[ [^]]+ \] ) \s+
( \[ [^]]+ \] ) \s+
\[ ( [^]]+ ) \] \s+
( .+? ) \s+ sec \s+
( .+? ) \s+ MBytes \s+
( .+? ) \s+ Mbits/sec
(?>
\s+
( .+? ) \s+ ms \s+
( .* )
|
)
\z
}x;
--- end code ---
I suspect the problem has nothing to do with the complexity of the regex.
If it's of interest, there a working script with the above code at: http://
www.perlmonks.org/?node_id=983839 (you'll need to add your own "use
Regexp::Debugger;").
Thanks again for an excellent addition to CPAN.
Kind regards,
Ken Cotterill.