in reply to Regexes: finding ALL matches (including overlap)
A little more complex, but possibly a little more memory friendly, is:$count = () = map /y/g, /<.*?>/g;
use List::Util 'sum'; $count = sum map { my $x = () = /y/g } /<.*?>/g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regexes: finding ALL matches (including overlap)
by kaif (Friar) on Jun 04, 2005 at 18:07 UTC | |
by kaif (Friar) on Jun 04, 2005 at 21:35 UTC |