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!
|
|---|