Home > Back-end >  Intellij how to delete all line containing annotation?
Intellij how to delete all line containing annotation?

Time:09-18

I want to delete all lines that contains annotation. I see there is a shortcut to delete line/selection. But how do i pass regex to the delete line shortcut so that all line that starts with @ gets deleted? I want to use like this ^@

CodePudding user response:

You have to use replace option. Use Ctrl R to open replace option, select regex(at the left side of search box there is a * sign). Enter @.*$ in replace box. Keep the replace with box empty.

The Regex means any line starting with @ followed by zero or more characters(digit/non digit/letter etc) and ended by end line.

enter image description here

  • Related