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


This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under
CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

Issue

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+@.*$

Answered By – Ridha Rezzag

people found this article helpful. What about you?