in reply to Regex: continuous matching positions
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"; }
|
|---|