Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 377
Mihai Galos Avatar asked Jun 03 '13 20:06

Mihai Galos


2 Answers

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.

like image 136
Martin Ender Avatar answered Oct 09 '22 18:10

Martin Ender


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

like image 31
Jerry Avatar answered Oct 09 '22 17:10

Jerry