remram44 / regex-cheatsheet

Cheatsheet for different regex syntaxes
https://remram44.github.io/regex-cheatsheet/regex.html
278 stars 64 forks source link

Vim \zs and \ze #26

Open OnlineCop opened 7 months ago

OnlineCop commented 7 months ago

I apologize in advance; I am a very infrequent vim user, so some of this may need to be double-checked.

Vim's \zs appears to work like PCRE's \K (which discards matched text up to that point):

Text: foofoofoofoo Result: foobarfoobar

On the other hand, vim's \ze appears to work more like a lookahead:

Text: foofoofoofoo Result: barbarbarfoo

I thought it might be useful to include the \K similarities in your Vim cheatsheet.

remram44 commented 7 months ago

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.