Friday, September 3, 2010

[bug?] \zs in regex not working with ":syn match ..."

Given the fillowing text in a buffer:

ABCDEF
GHIJKL

The following command does not highlight anything
and I don't see why:

:syn clear | syn match Error 'DEF\_.\zsGHI'

Nothing is highlighted. I would expect GHI to be highlighted.

Is it a bug?

You can reproduce it with:

$ (echo ABCDEF; echo GHIJKL) | \
vim -u NONE -N \
-c 'syntax on' \
-c ":syn clear | syn match Error 'DEF\_.\zsGHI'" -

If I remove \zs (start of match) then text is highlighted as expected:

:syn clear | syn match Error 'DEF\_.GHI'

If I use \ze, then text is also highlighted as expected:

:syn clear | syn match Error 'DEF\_.\zeGHI'

But somehow it does not work when I try to use \zs.
I'm using Vim-7.3.3 on Linux x86.

-- Dominique

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