This is a follow-up to that question. I\'ve learned that finding overlapping regex matches in Python is not straight-forward, so decided to do an additional inquiry to see h
It looks like tchrist has done all the hard work. If storing the matches and counting them afterwards is eating too much resource, then you could just change the regex-embedded code to just count the matches:
my $count = 0;
"bbboobb" =~ /(b.*o.*b)(?{$count++})(*FAIL)/g;
print "got $count matches\n";