Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I delete all the comments in all the project from Netbeans?

Tags:

netbeans

I need to modify a code but it has so many unused comments like this:

/*   6:    */ import java.util.List;
/*   7:    */ import org.apache.ibatis.session.SqlSession;
/*   8: 7  */ import org.apache.ibatis.session.SqlSessionFactory;
/*   9:    */ import org.apache.log4j.LogManager;
/*  10:    */ import org.apache.log4j.Logger;
like image 872
Midoes Avatar asked Jul 13 '15 18:07

Midoes


1 Answers

I can give one alternative way .I 'm using this method.

There is a option search and replace in netbeans. Enable regex option and then type a regex to match the comments and replace with empty character. go to edit menu and then replace.

use regex

/\\*.*?\\*/

to match /*comment*/ style comment

edit > replace

example

enter image description here

I think it's not hard to create a netbeans addon to do this with a button .

Also rectangular selection tool can be helpful some times if the area is a rectangle

example

enter image description here

like image 129
Madhawa Priyashantha Avatar answered Oct 19 '22 15:10

Madhawa Priyashantha