[plug] re: replacing text in search
James Devenish
devenish at guild.uwa.edu.au
Sat Aug 2 12:32:17 WST 2003
In message <1059753223.2187.2957.camel at jlmpc>
on Fri, Aug 01, 2003 at 11:53:43PM +0800, Jon Miller wrote:
> In vim how do I do a search and replace for the following
> /sbin/iptables? I've tried %s//sbin/iptables/g but this does not work.
> I'm need to include the / character in the search.
There are two typical methods for such problems with regexes (this FAQ
applies in general -- it is nothing specific to vim):
1/ Make use of the escape character (the backslash). For example:
:s/\/sbin\/iptables/blah/g
2/ Redefine the pattern separation character (so that it's no longer the
slash). For example, use the @ character (an arbitrary choice):
:s@/sbin/iptables at blah@g
PS. It would make more sense to more people if you don't put "re:" in
the subject line of new e-mails (i.e. only use it for replies).
More information about the plug
mailing list