我知道可以匹配一个单词,然后使用其他工具(例如grep -v)反转匹配.但是,我想知道是否可以使用正则表达式匹配不包含特定单词的行(例如hede).
输入:
hoho
hihi
haha
hede
Run Code Online (Sandbox Code Playgroud)
码:
grep "<Regex for 'doesn't contain hede'>" input
Run Code Online (Sandbox Code Playgroud)
期望的输出:
hoho
hihi
haha
Run Code Online (Sandbox Code Playgroud) 我想知道如何使用Python风格的Regex匹配不包含特定单词的行(只使用Regex,不涉及Python函数)?
例:
PART ONE OVERVIEW 1
Chapter 1 Introduction 3
Run Code Online (Sandbox Code Playgroud)
我想匹配不包含单词"PART"的行?
感谢致敬!