Original http://www.cnblogs.com/bitzhuwei/archive/2013/04/10/remove_all_pure_notes.html
Visual Studio is deleted with search replacement.Source codeAll // methods in pure comments and empty rows
Note: XML annotations including // <summary> are also deleted.
Step 1/2 (Delete comment): Use the CTRL + H quick replacement function to find the following content:
^ [\ T] * // [^ \ n] * \ n
ReplaceNull(Do not write anything), you can set the search range (I like to selectEntire Solution). Select the search option.Use Regular Expressions. Then clickReplace allThat's all.
This will delete the comments of the original line/And leave no blank lines.
Step 2/2 (delete empty rows): then set the search content
^: B * $ \ n
Run againReplace allAll empty rows will disappear.
-----------------------------------------------
The reason is that only comment lines are removed because
IntA =0;//Interger with initial value 0.
The mixed comments are too complicated for me to handle. I have to make plans later.
How complicated is it? Here are a few examples.
1 VaR Str1 = " Hello " ; // VaR str1 = Hello "; think this is easy, ha? 2 VaR Str2 =" Bye \" " ; // Bye "\". So, bite me 3 VaR Str3 = @" This is called 4 Multiple line string. "; // Kiss my ass, "Regular Expression"
What should we do in these cases? Let's discuss it again.
Visual Studio deletes the source with search replacementCodeAll // methods in pure comments and empty rows
Note: XML annotations including // <summary> are also deleted.
Step 1/2 (Delete comment): Use the CTRL + H quick replacement function to find the following content:
^ [\ T] * // [^ \ n] * \ n
ReplaceNull(Do not write anything), you can set the search range (I like to selectEntire Solution). Select the search option.Use Regular Expressions. Then clickReplace allThat's all.
This will delete the comments of the original line/And leave no blank lines.
Step 2/2 (delete empty rows): then set the search content
^: B * $ \ n
Run againReplace allAll empty rows will disappear.
-----------------------------------------------
The reason is that only comment lines are removed because
IntA =0;//Interger with initial value 0.
The mixed comments are too complicated for me to handle. I have to make plans later.
How complicated is it? Here are a few examples.
1 VaR Str1 = " Hello " ; // VaR str1 = Hello "; think this is easy, ha? 2 VaR Str2 = " Bye \" " ; // Bye "\". So, bite me 3 VaR Str3 = @" This is called 4 Multiple line string. "; // Kiss my ass, "Regular Expression"
What should we do in these cases? Let's discuss it again.