Remove comments in code

Remove comments with regex

First of all, we understand that the annotations in java are nothing more than 3:

1. // single line comment    

2 /* */ Multi-line comment

3 /** */ Documentation comments

We can use the replacement method in Ctrl+F to solve the problem, and replace all comments with empty, which solves the purpose of deleting comments. Here we need to use regular expressions to select Regular expression in options. Fill in the regular expression in the box above

remove java comments /* */: /\*{1,2}[\s\S]*?\*/

remove java comments //://://[\as\S]*?\n

Remove xml comments: <!-[\s\S]*?-->

Delete blank lines: ^\s*\n

\n or \r\n or \r may be newlines, depending on whether your system is windows or Unix/Linux or mac

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324699709&siteId=291194637