Why am I only getting one match instead of two? ... Clearly, the regex engine continues matching at the end of the first match.
The RE does, indeed, normally continue matching after the end of a match. This can be neatly exemplified as below (works the same under 5.14):
c:\@Work\Perl\monks>perl -wMstrict -le "print 'Perl version ', $]; ;; my $s = '123456'; ;; printf qq{'$_' } for $s =~ m{ (\d\d) }xmsg; print '' ;; printf qq{'$_' } for $s =~ m{ (?= (\d\d)) }xmsg; " Perl version 5.008009 '12' '34' '56' '12' '23' '34' '45' '56'
In reply to Re: Controlling matching position in regexes to match all proper substrings
by AnomalousMonk
in thread Controlling matching position in regexes to match all proper substrings
by pat_mc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |