Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: regex for multiple capture within boundary

by ikegami (Patriarch)
on Jul 14, 2006 at 19:57 UTC ( #561313=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @nums = $x =~ /(\S+)/g;
    
  2. or download this
    my @nums = split(' ', $x);
    
  3. or download this
    # @nums = ('1', '11', '2', '22', '222', '3', '33');
    my @nums = $x =~ /(\d+)/g;
    
  4. or download this
    # @nums = (['1', '11'], ['2', '22', '222'], ['3', '33']);
    my @nums = map { [ /(\d+)/g ] } $x =~ /(\S+)/g;
    
  5. or download this
    # @nums = ('2', '22', '222');
    my @nums = ($x =~ /\s(\S+)/)[0] =~ /(\d+)/g;
    
  6. or download this
    # @nums = ('2', '22', '222');
    my @nums = (split(' ', $x, 3))[1] =~ /(\d+)/g;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-11-27 01:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?