Match string not containing string
Given a list of strings (words or other characters), only return the strings that do not match.
以正则表达式 ^((?!badword).)*$ 搜索以下内容将会得到除1、4行以外的所有内容。此表达式对于log搜索比较有用。
badword可以替换为一组字符串,如(ECSdk|MOS),表达式^((?!(ECSdk|MOS)).)*$意为排除ECSdk和MOS 所在的行。
badword
test
one two
abadwords
three
参考:
https://www.regextester.com/15