Search code examples
emeditor

In EmEditor, how can I delete all rows that contain a given search pattern?


Search pattern \t[a-z] with Match Case open activated, highlights a few rows in a *.csv file (see screenshot). Is there a way to delete all these rows with one click in EmEditor?

Screenshot shows a couple of rows that contain search pattern: tab followed by lower case letter


Solution

  • You can press Ctrl+A, Delete to delete filtered lines while being filtered. You can record these keyboard steps to a macro. A recorded JavaScript for EmEditor macro will look like this. This macro will also abort the Filter after deleting lines:

    document.selection.SelectAll();
    document.selection.Delete(1);
    document.Filter("",0,0,0,0,0);
    

    To run this, save this code as, for instance, Macro.jsee, and then select this file from Select... in the Macros menu. Finally, select Run Macro.jsee in the Macros menu while filtered.