Re: regex for special chars
- View SourceOn 04/29/2011 04:18 AM, sinbad wrote:
> searching for "^[[K^[[?1l^[>" using "/" works.While I'm not sure what's happening, if you've already searched
> but when i use the same string in :%s, it says
> the pattern is not found. how to make it recongnize
> as "/" does. or is there any way to automatically
> convert the string to equivalent regexp that :%s
with "/", you can leave the search blank in the :s command:
to search for the last thing searched.
My first question would be to ask what the entire :s command is
that you're using. If there's a "]" in the replacement, it can
be seen as closing a character-class started in the search-part. E.g.
searches for the first space/slash/ampersand on the line and
replaces it with a "g". It doesn't look for all the "[ " and put
a closing "]" after them. This can be prevented by escaping
literal "[" characters (assuming that "^[" was a literal escape):
Hope that gives you some leads.
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php