Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete all comments in a selected code section?

Every once in a while, my code gets littered with many useless comments, most of them are obsolete lines of code, and some are obsolete "memos to self".
So I was wondering if there's a way to just select a code section, and with some magic key combination or macro, delete all of those.

Thanks.

like image 606
Oren A Avatar asked Oct 07 '10 20:10

Oren A


People also ask

How do you delete multiple comments?

Delete commentsRight-click the comment, and choose Delete Comment. To delete all the comments in the document, go to the Review tab, click the down-arrow on Delete, and choose Delete All Comments in Document. Select the content you want to comment on.


1 Answers

Remove all spaces before the comments too.

(\t+|\s+|\r\n)((/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(//.*))

http://blog.ostermiller.org/find-comment

like image 64
jonmeyer Avatar answered Oct 01 '22 11:10

jonmeyer