Use zero-width lookahead and lookbehind:
update: As my esteemed fellow monk Tankalus reminds me, you'll need to adjust your mechanism for retrieving the exact characters you require.$str = "aaabcabcdebcaabebcb"; while($str =~ /(?<=\w{3})(bc)(?=\w{2})/g){ print "$-[1],$+[1],$1\n"; }
In reply to Re: Regex: continuous matching positions
by duff
in thread Regex: continuous matching positions
by theshz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |