I was wondering how I would search and replace all /'s with -'s in vi.

%s///-/g doesn't work obviously.


Try escaping your /s, with a \.

\/. yes, it looks awful. That's how I remember it :P


You can use any delimiter you wish, not just /. For example, !:


This way, / becomes non-special and doesn't have to be escaped.


replacing separator is not always /.



in the text of "http://hoge/hoge"

  • that has already been said by ephemient – Aaron Thoma Jan 16 '12 at 23:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.