Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • This does exactly what I need it to do, I am unfamiliar with \zs but it looks like that was just what it needed Commented May 7, 2021 at 13:43
  • Just doing a bit of digging and I'm finding some strange functionality with \zs. It looks like it breaks some other match expressions, for example if you have syn match checkNumber "\<[0-9]\+\>" and then the \zs expression following after Commented May 7, 2021 at 15:52
  • @TheLovelySausage can't reproduce in 8.2-2815: i.sstatic.net/xZ2PK.png (I did :syn match checkNumber "\<[0-9]\+\>", :hi link checkNumber Keyword, :syn match noneIndentError /^\( \{4\}\)*\zs \{,3\}/, :hi link noneIndentError Error) Commented May 8, 2021 at 4:17
  • @TheLovelySausage Sometimes using \zs and ze in syn match expressions might pose a problem if you expect the part that's not part of the match to actually match some other syn match rule... In those cases, you'll need to do an actual zero-width look-behind or look-ahead. But it's hard to tell you what's wrong with your setup without more details, so perhaps ask a separate question for that if you like. BTW, you might like the Vi and Vim Stack Exchange for questions on Vim (oh, I guess already told you about it in another question...) Commented May 9, 2021 at 23:56
  • Hello again @filbranden !, yes it's me again and it looks like you're right, the first instance of \zs is not finding a match so the expression doesn't have a \ze. I onlt really know Perl RegEx so this has me baffled. I def want to try the Vim exchange Commented May 10, 2021 at 6:49