Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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
Domain Nodelet?
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 having an uproarious good time at the Monastery: (6)
As of 2023-03-30 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (74 votes). Check out past polls.

    Notices?