Regexp – delete all lines containing OR NOT containing…
stuff
January 15th 2015 (5 years ago)
I mostly use Sublime (for web work or just to edit some files) and I often have a a .txt file with a list of items with similar/same path or any other lists, that have many same entries i need to remove quickly, to obtain the list i need.

Sublime support Regular expressions(Read about Regex here), this becomes very simple task to perform, which goes like this:

Delete all lines containing…

^.*YOUR_TEXT.*\n

Delete all lines NOT containing…

^((?!YOUR_TEXT).)*$

The Regex Coach

Writing proper Regex command can be though, it’s very simple to make even a smallest mistake, that’s why i recommend to practice (or simply check your statement) with Dr. Edmund Weitz application called The Regex Coach (Go read about it here here).