You can do this by doing a global match and resetting pos on each iteration to the position after the match, like this:
$_ = "aaaaa"; while (/aa/g) { print "Match at $-[0]\n"; pos = $-[0] + 1; }
-- Mike
--
XML::Simpler does not require XML::Parser or a SAX parser.
It does require File::Slurp.
-- grantm, perldoc XML::Simpler
In reply to Re: multiple matches with regexp
by thelenm
in thread multiple matches with regexp
by almaric
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |