in reply to Controlling matching position in regexes to match all proper substrings

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'

  • Comment on Re: Controlling matching position in regexes to match all proper substrings
  • Download Code