in reply to Trying to count the captures in a compiled regular expression
How about just using it, marked optional, and seeing how many captures you get?
The PerlMonk tr/// Advocate
$_ = 'anything'; my @capture_count; my $regex = qr/one(.*?)((two)(four))/; @capture_count = /(?:$regex)?/; print @capture_count." captures\n";
The PerlMonk tr/// Advocate
In Section
Seekers of Perl Wisdom