Reputation: 4191
I want to search in vim,
/</string>
but it didn't work, how to do can exactly match "</string>
"?
Upvotes: 6
Views: 17172
Reputation: 59
Use :s instead. Eg.
%:s:/home/johndoe/.git::gc
This examples searches for the pathname (g for greedy) and replaces with nothing, if the user confirms (c for confirm) help :s (help on substitute) does not tell that one may use any character to separate search and replace strings. It doesn't have to be a slash /
Upvotes: 0
Reputation: 179
Try to search by escaping the/
by adding \
before the /
.
Eg: /<\/string>
This will work
Upvotes: 4
Reputation:
If you're trying to search for a literal value, the \V "very no magic" prefix can be helpful. When specified, every character except \ is treated as its literal value, so in your case /\V would match exactly what you want. I often find it more readable than interspersing backslashes through the pattern.
You can look at :help magic
for more information.
Upvotes: 6
Reputation: 172510
An alternative to escaping the slash (\/
) is to use the backward-search: ?</string>
(and navigating to next matches with N
instead of n
).
Upvotes: 15