Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: In place replace, ignoring between quotes

by AnomalousMonk (Archbishop)
on Oct 25, 2013 at 21:27 UTC ( [id://1059759]=note: print w/replies, xml ) Need Help??


in reply to In place replace, ignoring between quotes

Can also be done as a 'pure' regex (but without need for  /e evaluation) with the Special Backtracking Control Verbs (see perlre) of 5.10+.

>perl -wMstrict -le "my $s = q{cd / ; /path/latest --van --args \"fName='foo';jobCode=12;jobId=34 +;\" < j1.R > j1.txt}; print qq{'$s'}; ;; my $d_quo = qr{ \" [^^\"]* (?: \\. [^\"]*)* \" }xms; ;; $s =~ s{ $d_quo (*SKIP)(*FAIL) | ; }{&&}xmsg; print qq{'$s'}; " 'cd / ; /path/latest --van --args "fName='foo';jobCode=12;jobId=34;" < + j1.R > j1.txt' 'cd / && /path/latest --van --args "fName='foo';jobCode=12;jobId=34;" +< j1.R > j1.txt'

Note: Without the escapology required by the Windoze command line, the  $d_quo regex is
    my $d_quo = qr{ " [^"]* (?: \\. [^"]*)* " }xms;
I hope that's a little more clear!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found