开发者

In Vim, how do I match on "=" but not on "=="?

开发者 https://www.devze.com 2022-12-21 14:01 出处:网络
I\'ve tried a number of different search patter开发者_如何学Pythonns: [^=]=[^=] works but only if = is not at the beginning/end and it also matches the sandwiching characters

I've tried a number of different search patter开发者_如何学Pythonns:

  • [^=]=[^=] works but only if = is not at the beginning/end and it also matches the sandwiching characters
  • =\@!==\@! seems like it should work because \@! matches nothing but requires a match, but it doesn't (see :help pattern-overview)
  • [^=]\@==[^=]\@= also doesn't but seems like it should

Suggestions?


Ah hah: =\@<!==\@!


How about

[^=]\?\zs=\ze[^=]\?

\zs starts the match \ze ends the match

0

精彩评论

暂无评论...
验证码 换一张
取 消