perl-diddler has asked for the wisdom of the Perl Monks concerning the following question:
Why isn't the match count in the 2nd paren working when I have a range of {1-3} (as in tgt_RE1), but does when I have a range of 2 (as in tgt_RE2)?> perl -we' use strict; use warnings; use P; my $tgt_RE1 = qr{ ([SK]) ([0-9]{1-3}) ([-_\.\w]+) }x; my $tgt_RE2 = qr{ ([SK]) ([0-9]{2}) ([-_\.\w]+) }x; my $pat="S01boot.usr-mount"; my @tstAr1 = $pat =~ /$tgt_RE1/; my @tstAr2 = $pat =~ /$tgt_RE2/; P "tstar1=%s", \@tstAr1; P "tstar2=%s", \@tstAr2;' tstar1=[] tstar2=['S', 01, "boot.usr-mount"]
Sure looks like it *should* work, but how can it not match? FWIW, I had "\d" in place of 0-9 on an earlier revision of this test case.
*Scratching head*... thanks...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Str8-forward" RE prob? {w/range}
by Anonymous Monk on Oct 15, 2016 at 00:56 UTC | |
by perl-diddler (Chaplain) on Oct 15, 2016 at 01:03 UTC | |
|
Re: "Str8-forward" RE prob? {w/range}
by Anonymous Monk on Oct 15, 2016 at 00:47 UTC | |
|
Re: "Str8-forward" RE prob? {w/range}
by Anonymous Monk on Oct 15, 2016 at 00:45 UTC |