Mihai Galos
Mihai Galos

Reputation: 1897

Matching a line not containing a word in Notepad++

I am trying to match the lines in following not input NOT containing "VelSign" (using Notepad++):

#MARKER VelSign 457.45 50 kmh

#MARKER IsBridge true

#MARKER TrafficSign 45

#MARKER TrafficLight 45 445 444 40

I am using the following regex: ^#MARKER (?!.*VelSign).*$

Doesn't seem to work. What am I doing wrong?

Upvotes: 20

Views: 49780

Answers (2)

Martin Ender
Martin Ender

Reputation: 44259

Make sure that you upgrade Notepad++ to version 6, as they changed quite a lot in the regex engine. Especially line breaks and lookarounds were a bit problematic in earlier versions.

Upvotes: 11

Jerry
Jerry

Reputation: 71538

Turn this:

^#MARKER (?!.\*VelSign).*$

Into this:

^#MARKER (?!.*VelSign).*$

You are escaping the * operator, which causes the match of a literal * instead of 0 or more ..

Also, make sure that you have checked the RegularExpression option (see the third radio button):

enter image description here

Upvotes: 12

Related Questions