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?


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 ^\[email protected]*$

Answered By – Ridha Rezzag

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published