Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

share|improve this question
up vote 3 down vote accepted

Try escaping your /s, with a \.

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

share|improve this answer

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


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

share|improve this answer

replacing separator is not always /.



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

share|improve this answer
that has already been said by ephemient – accolade Jan 16 '12 at 23:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .