Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: matching a line with ' and "

by hipowls (Curate)
on Jul 18, 2008 at 08:57 UTC ( [id://698542]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $string = qq{var1='1' var2="2" var3="3"};
    
    while ( $string =~ /(\w+)=(['"])(.*?)\2/g) {
        print "$1 = $3\n";
    }
    
  2. or download this
    use 5.010_000;
    
    while ( $string =~ /(?<variable>\w+)=(?<delim>['"])(?<value>.*?)\k<del
    +im>/g) {
        say "$+{variable} = $+{value}";
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (1)
As of 2024-04-19 00:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found