bAN
bAN

Reputation: 13825

Replace all newline not followed by specific

I can easily find '\n' in notepad++, but my problem here is that I have to find '\n' when not followed by a specific character ("#" in this case). So do I use Regex with '\n'? Is it possible?

Example :

Stuff to ignore
#Like that

Stuff
To change

Upvotes: 3

Views: 1367

Answers (2)

Amelia
Amelia

Reputation: 2970

You can find some specifics in this question, but first make sure your line-endings are purely \n.

Mac OS line-endings are \r (OSX is \n), Windows/DOS are \r\n,and UNIX-style are \n, mostly.

The regex you are looking for is probably .*\n[^#].*, specifying [^...] (not set)

But you could try using the EOL regex character, $, instead:
.*$[^#].*

Or, as xdazz said, just try \n(?!#)

Upvotes: 2

xdazz
xdazz

Reputation: 160833

Try lookahead assersion:

\n(?!#)

Upvotes: 7

Related Questions