Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text: Regular Expression to Remove Lines NOT Starting With

I'm using Sublime Text to edit a batch file on Windows. I'd like to remove all of the lines that do not begin with ECHO or REM. I figure this must be possible with regular expressions, but I can't figure it out. Anybody?

like image 504
Nick Avatar asked Oct 06 '12 02:10

Nick


1 Answers

From what I can understand, Sublime Text uses Python's regex engine.

This code matches all lines that don't begin with ECHO and REM:

^(?!(?:ECHO|REM)).*\s*
like image 161
Blender Avatar answered Nov 04 '22 18:11

Blender