Monday, October 11, 2010

Re: win32 Gvim match bug: echo match("","\\z"), return E68: Invalid character after \z

On Tue, 12 Oct 2010, Zac Lee wrote:

> windows xp, gvim
> :echo match("","\\z")
> E68: Invalid character after \z
> thanks

This isn't a bug. If you're trying to match a backslash followed by the
letter 'z', you need to double the backslash. In double quotes,
backslash is an escape character. So, the regular expression you're
matching contains:

\z (and not \\z)

\z is the start of a special sequence. \\z is a literal backslash
followed by a z. If you're not trying to match a literal '\z', maybe
you're looking for \zs, \ze, or \Z.

See:
:help /\\
:help /\z(
:help E68
:help /\zs
:help /\ze
:help /\Z

--
Best,
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: