in reply to Re^2: How can I access the number of repititions in a regex?
in thread How can I access the number of repititions in a regex?
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How can I access the number of repititions in a regex?
by pat_mc (Pilgrim) on Dec 18, 2008 at 15:15 UTC |