使用 Grep 在 BBEdit 中匹配不包含模式的行

Match line not containing a pattern in BBEdit with Grep

我无法找到正确的 grep 表达式,因为它无法匹配 BBEdit 中不包含日期的整行,尽管我在网上找到了许多 "match ... not containing" 主题...

我有这个文本文档:

Some Text
Some more text,even more text,2015-06-17,2015-06-20
A third line of text
Last line of text, 2015-06-17

此表达式将 select 所有包含日期​​引用的行,格式为 4 位数字 + “-” + 2 位数字 + “-” + 2 位数字

^.*\d\d\d\d-\d\d-\d\d.*$

我想完全相反地匹配,目的是删除所有不包含日期引用的行。我已经尝试过像

这样的解决方案
^.*[^\d\d\d\d-\d\d-\d\d].*$

但到目前为止还没有成功。有人能指出我正确的方向吗? 谢谢。

一个选项

"[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}"

如果你想排除没有这个匹配的行它更容易使用 grep -v

BBEdit 支持 Perl 样式模式扩展(请参阅手册第 183 页)including negative lookaheads (?!...).

我相信这会如你所愿:

^((?![\d\d\d\d-\d\d-\d\d]).)*$