$count++ while $string =~ /\GAA/gc;Er, no, the \G there serves no purpose as that's the default behaviour anyway. On this other hand this will work, by only consuming the first character of the match:
$count++ while $string =~ /A(?=A)/g;
Dave.
In reply to Re^2: counting overlapping patterns
by dave_the_m
in thread counting overlapping patterns
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |