正则表达式:匹配行不以短语开头

Regex: Match lines NOT starting with phrase

我发现了这个关于否定前瞻的问题,但它在 Regexr(我用来验证正则表达式)中对我不起作用: Find lines not starting with " in Notepad++

http://www.regexr.com/

我想匹配不以 "Sold, ship now"

开头的每一行

目前,在 regexr 上,当我在以下文本中使用表达式 ^(?!Sold, ship now) 时:

Sold, ship now: [FreeEconomy Shipping]

Sold, NOT ship now: [FreeEconomy Shipping]

Sold, ship now: [FreeEconomy Shipping]

我收到 0 场比赛。

您需要使用多行标记。其中,在 regexr 的情况下,可以这样激活:

此外,如果您想 return 不以 Sold, ship now 开头的行的完整性,我建议您在表达式中使用点加号:

^(?!Sold, ship now).+