Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Arbitrary number of captures in a regular expression

by Sidhekin (Priest)
on Sep 25, 2007 at 11:06 UTC ( #640897=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my (@match) = $str =~ /(?:^foo (?=(?:m \d+ )+bar)|(?<!^)\G)m (\d+) /g;
    
  2. or download this
    my (@match) = $str =~
      / (?: ^foo\ (?= (?:m\ \d+\ )+bar) # overall match from ^foo
    ...
        )
        m\ (\d+)\                       # grab each digit sequence
      /xg;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2016-07-27 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (247 votes). Check out past polls.