Another example of the effect of what you were doing in the OP (i.e., a non-zero-width capture within a zero-width assertion):
A useful trick when you want overlapping captures.Win8 Strawberry 5.8.9.5 (32) Wed 11/11/2020 18:02:18 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my $s = 'ABCDE'; while ($s =~ m{ (?= (\w+)) }xmsg) { print $1; }; ^Z ABCDE BCDE CDE DE E
Update: This might be a better example of overlapping capture:
Win8 Strawberry 5.8.9.5 (32) Wed 11/11/2020 21:41:12 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my $s = 'ABCDE X YZ FGHI'; while ($s =~ m{ (?= (\w{3})) }xmsg) { print "'$1'"; }; ^Z 'ABC' 'BCD' 'CDE' 'FGH' 'GHI'
Give a man a fish: <%-{-{-{-<
In reply to Re: Return value from positive look behind (updated)
by AnomalousMonk
in thread Return value from positive look behind
by bestresearch2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |