in reply to Re: Controlling matching position in regexes to match all proper substrings
in thread Controlling matching position in regexes to match all proper substrings
\G doesn't help, forgot about the limitations!¹
But the pos approach works:
DB<129> $_='12aaa67aaaa23' => "12aaa67aaaa23" DB<130> print pos($_) while ($_=~/(a\Ga)/g) DB<131> print pos($_),"\n" and pos($_)=pos($_)-1 while ($_=~/(aa)/g) 4 5 9 10 11
HTH! :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
¹) perlretut : the \G anchor is only fully supported when used to anchor to the start of the pattern.
|
|---|