There is such possibility, but using 'highly experimental' :) code:
$_='this is some text(55). this is another text. there are 2 texts.'; @re=/text(?{$cnt1++})|\d+(?{$cnt2++})/g; print "'text' occured $cnt1 times\n"; print "'\\d+' occured $cnt2 times\n";
But there are some problems: what if one of your regexps is part of another one?
In reply to Re^3: How can I access the number of repititions in a regex?
by grizzley
in thread How can I access the number of repititions in a regex?
by pat_mc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |