Negative look ahead python regex

回眸只為那壹抹淺笑 提交于 2019-12-03 12:10:31
Qtax

Lookaheads are "zero-width", meaning they do not consume any characters. For example, these two expressions will never match:

  1. (?=foo)bar
  2. (?!foo)foo

To make sure a number is not some specific number, you could use:

(?!42)\d\d # will match two digits that are not 42

In your case it could look like:

(?!02)[\da-f]{2} (?!0d)[\da-f]{2}

or:

(?!02 d0)[\da-f]{2} [\da-f]{2}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!