I have text with some lines that contains properly escaped double quotes in the lines, and some as shown below:
bla1 "aaa"bbb"ccc" bla1
bla2 "aaa\"bbb\"ccc" bla2
Results after substitution should be
bla1 "aaa\"bbb\"ccc" bla1
bla2 "aaa\"bbb\"ccc" bla2
but not:
bla1 "aaa\"bbb\"ccc" bla1
bla2 "aaa\\"bbb\\"ccc" bla2
In other words, it should avoid double quotes in strings where they are not escaped and do not touch lines that are already properly escaped
So far I got a second result with this
%s:\(\s".\+\)\(".\+\)\(".\+"\s\):\1\\\2\\\3:g
Then I tried a negative lookbehind to tell the engine not to match if there is a backslash before the quotes
(?<!\) which in vim should be something like @<!\
%s:\(\s".\+\)\@<!\\\(".\+\)@<!\\\(".\+"\s\):\1\\\2\\\3:g
But I think I lost a little.
Note:
There is only one line in the line. The line is enclosed in double quotes and may contain double quotes inside - only inside this should be escaped