简体   繁体   English

Vim找到模式,除非它匹配

[英]Vim find pattern unless it matches

I have a space delimited set of hex values and want to find /[0-9a-f]\\{2\\} unless the value is 00 . 我有一个以空格分隔的十六进制值集,并希望找到/[0-9a-f]\\{2\\}除非值为00 For example, if the buffer is 例如,如果缓冲区是

00 00 00 00 18 00 00 00

the pattern should match the 18 but not the white space or the 00 . 模式应匹配18但不匹配空格或00

This can be done with the following regular expression: 这可以使用以下正则表达式完成:

\x\{2}\(00\)\@<!

Explanation: 说明:

  • \\x : hex digit: [0-9A-Fa-f] \\x :十六进制数字:[0-9A-Fa-f]
  • \\{2} : matches two of the preceding atom \\{2} :匹配前面两个原子
  • \\(00\\) : an atom containing 00 \\(00\\) :一个包含00的原子
  • \\@<! nothing, requires NO match behind 什么都没有,后面不需要比赛

For more information, see: 有关更多信息,请参阅:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM