We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
I apologize in advance; I am a very infrequent vim user, so some of this may need to be double-checked.
\zs
\ze
Vim's \zs appears to work like PCRE's \K (which discards matched text up to that point):
\K
s/foo\Kfoo/bar/g
:%s/foo\zsfoo/bar/g
Text: foofoofoofoo Result: foobarfoobar
foofoofoofoo
foobarfoobar
On the other hand, vim's \ze appears to work more like a lookahead:
s/foo(?=foo)/bar/g
:%s/foo\zefoo/bar/g
:%s/foo\(foo\)\@=/bar/g
Text: foofoofoofoo Result: barbarbarfoo
barbarbarfoo
I thought it might be useful to include the \K similarities in your Vim cheatsheet.
The text was updated successfully, but these errors were encountered:
This might be worth adding, though I don't know which other dialects have that feature. They also overlap somewhat with the look-around operators.
Sorry, something went wrong.
No branches or pull requests
I apologize in advance; I am a very infrequent vim user, so some of this may need to be double-checked.
\zs
sets the start of a match.\ze
sets the end of a match.Vim's
\zs
appears to work like PCRE's\K
(which discards matched text up to that point):s/foo\Kfoo/bar/g
:%s/foo\zsfoo/bar/g
Text:
foofoofoofoo
Result:
foobarfoobar
On the other hand, vim's
\ze
appears to work more like a lookahead:s/foo(?=foo)/bar/g
:%s/foo\zefoo/bar/g
:%s/foo\(foo\)\@=/bar/g
Text:
foofoofoofoo
Result:
barbarbarfoo
I thought it might be useful to include the
\K
similarities in your Vim cheatsheet.The text was updated successfully, but these errors were encountered: