Search code examples
pycharm

Delete all lines that have a specific word in Pycharm


Using Pycharm, I want to delete all lines that have a specific word. Does someone know how we can do that?


Solution

  • Use replace feature with regex (e.g. ^.*hello.*$\n) to match the whole line (and \n) containing a word and replace it with nothing:

    enter image description here