Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 perusing the Monastery: (5)
As of 2014-07-26 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (176 votes), past polls