更新时间:2021-10-16 22:15:14
不,没有直接的not运算符.至少不是您希望的方式.
No, there's no direct not operator. At least not the way you hope for.
不过,您可以使用零宽度的负向超前查询:
You can use a zero-width negative lookahead, however:
\((?!2001)[0-9a-zA-z _\.\-:]*\)
(?!...)
部分的意思是仅在以下不匹配(因此:否定)的文本跟随(因此:lookahead)匹配时匹配.但是,它不匹配实际上不会消耗与其匹配的字符(因此为零宽度).
The (?!...)
part means "only match if the text following (hence: lookahead) this doesn't (hence: negative) match this. But it doesn't actually consume the characters it matches (hence: zero-width).
环顾四周实际上有4种组合,带有2个轴:
There are actually 4 combinations of lookarounds with 2 axes: