正则表达式:匹配与子正则表达式不匹配的行
假设我有一个正则表达式 foobar,并且我想查找文档中与 foobar 不匹配的所有行。我可以这样做吗?我该怎么做?
Let's say I have a regex expression foobar and I want to find all lines in a document that contain no match to foobar. Can I do this? How do I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用多行选项,匹配所有不包含 foobar.. 的行。
With multiline option, matches all line that does not contain foobar..
正则表达式
对于你的情况可以这样
编辑:
但如果你只想 grep 一些东西,你可以使用 -v 参数:
The regexp
for your case can be this
edited:
but if you only want grep something you can use -v parameter: