Check out the pos function. For example:
This sets the position to start looking for the next match to 1 past the start point of the previous match. And it gets you the output you want.$str = "aaabcabcdebcaabebcb"; while($str =~ /(\w{3}bc\w{2})/g){ print "$-[1],$+[1],$1\n"; pos($str) = $-[1]+1; }
In reply to Re: Regex: continuous matching positions
by Tanktalus
in thread Regex: continuous matching positions
by theshz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |