How can I search for the dot character using the search command?

Posted by lk on Stack Overflow See other posts from Stack Overflow or by lk
Published on 2010-05-12T17:05:55Z Indexed on 2010/05/12 17:54 UTC
Read the original article Hit count: 166

Filed under:
|
|

I'm trying to use the Search command in Vim:

:Rs/F/T/X

R = range
F = text to find
T = text to replace with
X = options

But, when I want to search for the "." (dot character) I'm getting some problems.

The task: Replace all occurences of " ." (space dot) for ">" (greater-than)

So, first I tried this:

:%s/ ./>/g

But this changed me all the " ." (space ANY-CHARACTER) to the ">" character.

Then I remembered that the dot character is a special one, so I tried this:

:%s/ \./>/g

But vim threw me an error: E486 Can't find pattern " \."

And finally I tried this crazy thing:

:%s/" ."/>/g and this :%s/" \."/>/g

But I got the same result: E486 Can't find pattern...

So, how can I search for the dot character using the search command?

PS: Sorry for my poor Enlish.

© Stack Overflow or respective owner

Related posts about vim

Related posts about gvim