Tuesday, January 25, 2011

Re: How to replace "\" to "\\"

Thanks very much. The second works!
I am still wondering how it work. It seems to replace the " \%(\\\)\@<!\\\$(\\\)\@! " part to "\\\\". Would you help to explain the meaning of the replaced part? 

On Wed, Jan 26, 2011 at 3:18 PM, ifys0325 <ifys0325@163.com> wrote:
 
 
 
 
  I have a text containing both "\" and '\\". Now I want to replace all the "\" to "\\", but leave those have already been "\\" alone. How can I achieve this?
 
 
:%s/\\/\\\\/g

2011-01-26

ifys0325
 
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: