Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Trying to count the captures in a compiled regular expression

by BooK (Curate)
on May 03, 2004 at 06:48 UTC ( #349937=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $regex = qr/foo/; # should return 0
    
  2. or download this
    sub captures {
        my $re = shift;
        return scalar ( @_ = '' =~ /(?:($re))?/ ) - 1;
    }
    
  3. or download this
     
    $regex = qr/(?x)  # (comment)
                (?-x) # (capture) (?x) # (comment)/;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://349937]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-11-27 16:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (186 votes), past polls