But I don't want to match only at that position, like the \G anchor would have.
Then don't use \G. Without \G the construct does exactly what you want:
use 5.010; $_ = 'aaababaab'; while (/(a+)/pcg) { say pos($_), " ", $1; } __END__ 3 aaa 5 a 8 aa
In reply to Re: Regex: continue from previous match
by moritz
in thread Regex: continue from previous match
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |