Friday, April 29, 2011

Re: regex for special chars

On 29/04/11 7:18 PM, sinbad wrote:
> hi,
>
> searching for "^[[K^[[?1l^[>" using "/" works.
> 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
> understands.

Put backslashes before the [ which will start collections without that.
It should have them when using "/" too, but it must backtrack and 'fix'
it for you better than :s does.

^[\[K^[\[?1l^[>

\e would also be more readable than ^[, IMHO:

\e\[K\e\[?1l\e>

Mind you, I'd hardly call that readable either.

Grins,

Ben.


--
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

No comments:

Post a Comment