Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
It outputs all six possible splits:perl -e '"01234" =~ /^(.+)(.+)(.+)$(?{ print "$1 $2 $3\n" })(*FAIL)/'
Now if I change the third capture slightly (add optional "z" that should never match)012 3 4 01 23 4 01 2 34 0 123 4 0 12 34 0 1 234
then the program outputs only five variants and "0 1 234" disappears. With more complex regexps a whole lot of variants are missing. Is it a bug? Tested with Perl 5.22.2.perl -e '"01234" =~ /^(.+)(.+)((?:.z?)+)$(?{ print "$1 $2 $3\n" })(*FA +IL)/'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bug with finding all regexp matches
by AnomalousMonk (Archbishop) on Oct 15, 2016 at 16:08 UTC | |
by Anonymous Monk on Oct 15, 2016 at 17:32 UTC | |
|
Re: Bug with finding all regexp matches
by BrowserUk (Patriarch) on Oct 15, 2016 at 17:36 UTC | |
by Anonymous Monk on Oct 15, 2016 at 18:12 UTC | |
by Anonymous Monk on Oct 15, 2016 at 18:18 UTC | |
by Anonymous Monk on Oct 15, 2016 at 19:07 UTC | |
by dave_the_m (Monsignor) on Oct 15, 2016 at 21:02 UTC | |
| |
|
Re: Bug with finding all regexp matches
by kroki (Novice) on Oct 16, 2016 at 09:08 UTC | |
by AnomalousMonk (Archbishop) on Oct 16, 2016 at 20:45 UTC |