In this short post you can find how to remove all lines which contains specific work in Sublime Text.

You may also check this detailed article: Sublime 3 Regex Search and Replace Examples

All the steps to find and remove with regular expressions lines with a given word or words. Lets try to remove all lines which contain word - tex:

  • CTRL + H to show the find and replace window
  • Enable the Regex button by .* - as shown on the image
  • In the Find field: add regex .*text.*\r?\n

Note where the \r?\n depends on the system which is used - Linux or Windows. \n might be enough in most cases.

  • Leave the Replace field empty.

  • Click the Find or Find All to investigate the lines

  • Finally press Replace All button

All steps to replace full lines with Sublime Text 4 is shown on the image below: