Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Regex to match "this=that" multiple times

by smokemachine (Hermit)
on Jul 16, 2008 at 19:18 UTC ( [id://698118]=note: print w/replies, xml ) Need Help??


in reply to Regex to match "this=that" multiple times

> perl -MData::Dumper -e '%hash = "lala=lele lili=lolo lulu = lala\nae +iou =abcde" =~ /(\S+)\s*=\s*(\S+)/g; print Dumper \%hash' $VAR1 = { 'lulu' => 'lala', 'lili' => 'lolo', 'lala' => 'lele', 'aeiou' => 'abcde' };
or
> perl -MData::Dumper -e '@array = "lala=lele lili=lolo lulu = lala\na +eiou =abcde" =~ /\S+\s*=\s*(\S+)/g; print Dumper \@array' $VAR1 = [ 'lele', 'lolo', 'lala', 'abcde' ];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-03-28 21:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found