Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find string NOT preceded by semicolon using Notepad++

In a directory with hundreds of xml-files, I need to find the files which contain the string nature where this string is not preceded by a semicolon on the same line.

For example:

It should find:

STATUS_OMS.PLUVOI = "NATURE"

It should NOT find:

; Horse Nature Product..

I'm rather new to regular expressions. I tried a lot, this once seems to come close, but the negation does not have the desired effect.

[^;].+?nature

Any pointers to what I'm doing wrong?

Please note that I'm using notepad++

like image 591
user1568531 Avatar asked Apr 15 '26 18:04

user1568531


1 Answers

You're looking for:

^[^;]*nature

which looks for a line starting with any number of non-semicolon characters followed by "nature".

Your regex:

[^;].+?nature

looks for exactly one non-semicolon character anywhere in a line, followed by one or more characters of any kind, followed by "nature".

like image 194
svinja Avatar answered Apr 17 '26 11:04

svinja