Chris J Harris
Chris J Harris

Reputation: 1851

Searching in Vim for string with period (dot) in it

I see many similar questions to this here but they don't seem to answer mine. I'd like to search (and, ultimately, replace) a string with a period character in the middle of it - eg

like.this

Most of the similar answers tell me to use the backslash to escape the . character, but :s/like\.this does not work, and nor does :s/\like.this. Could anyone please tell me if there's something I'm missing?

Thanks

Upvotes: 0

Views: 927

Answers (1)

vs97
vs97

Reputation: 5859

:s is only looking in the current line, try something like:

:%s/like\.this/bar/g 

where, %s means to search all strings, and you replace like.this with bar.

Upvotes: 7

Related Questions