Reputation: 736
I found this question about negative lookaheads, but it doesn't work for me in Regexr (which I use to validate regular expressions): Find lines not starting with " in Notepad++
I want to match every line that does not start with "Sold, ship now"
Currently, on regexr, when I use the expression ^(?!Sold, ship now)
on the following text:
Sold, ship now: [FreeEconomy Shipping]
Sold, NOT ship now: [FreeEconomy Shipping]
Sold, ship now: [FreeEconomy Shipping]
I receive 0 matches.
Upvotes: 3
Views: 4960
Reputation: 414
You'll need to use the multiline flag. Which, in the case of regexr, can be activated like so:
Also, if you'd like to return the entirity of the lines that do not begin with Sold, ship now
, I'd recommend utilizing dot plus in your expression:
^(?!Sold, ship now).+
Upvotes: 3