I am working with a file where I need to swap string A and String B's locations simultaneously with a regex inside the vim. Here is an example line of code:succ_1st=`grep 'resulted in successful answer' $path_tmp/named.stats.tmp | sed '/localhost.localdomain/,/testdns.net/{//!d}' | awk '{ print $1 }' |grep -m1 ''`I need it to look like this:succ_1st=`sed '/localhost.localdomain/,/testdns.net/{//!d}' $path_tmp/named.stats.tmp | grep 'resulted in successful answer' | awk '{ print $1 }' | grep -m1 ''`The grep and sed statements in each line are identical, I just need to swap locations of each. I can do this with sed outside my file but I need to be able to do this with regex inside the vim. Here is what I have tried:%s/grep 'search string'/sed '\/search string\/,\/search string\/{\/\/!d}'/gThis only REPLACES and not swaps:I have also tried :%s/\v(grep[^$]*)([$][^|]*)[|] (sed[^|]*)/\3\2| \1/Which fails and returns:E486: Pattern not found: \v(grep[^$]*)([$][^|]*)[|] (sed[^|]*)   Please do not mark this as duplicate, vote to close, downvote, etc.. as it is not a dup. All other threads deal with doing this using sed which is not what I want. EDIT -- Note that I am invoking Vim using a Vi alias which points to /usr/bin/vim. 
swap strings of text inside vim using regex
files;regular expression;quoting