Am 16.09.2012 10:02, schrieb Martin Jiricka:> Dear Vim users,
> I do not understand why output of this command:
> :echo matchstr('123abc','\v(123)\@=abc')
> is `123abc`. I'm using zero-width pattern, so I would like to get just
> `abc`. What am i doing wrong?
Your (very magic) zero-width item should be `@<=', not `\@=':
:echo matchstr('123abc','\v(123)@<=abc')
abc
:h \@<=
`\v\@=' is the same as `@\=' (match `@' zero or one times):
:echo matchstr('123@abc','\v(123)\@=abc')
123@abc
Match a literal `@=':
:echo matchstr('123@=abc', '\v(123)\@\=abc')
123@=abc
--
Andy
--
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
Sunday, September 16, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment