androidandroid-studio

How to replace/delete comments or lines starts with particular word in Android studio?


I want to delete all comments in an android project, all the comments start with // or any other specific characters?


Solution

  • Note: I'm answering myself I figure it out

    In android studio, right-click on the project and select Replace in files, a new window pop up

    1 in the first search field tape in this ^\s+//.*$

    2 in the second search field, keep it empty if you just want to delete all the lines that start with //

    3 now hit replace all button.

    if you want to delete other lines that start with different characters, example @ the expression should be like this ^\s+@.*$