Notepad++ obviously recognizes all comments as such. Is there a way to simply delete all?
Edit: Stat-R's bookmark method has helped greatly, not only for removing comments but for conditionally removing lines in general.
Notepad++ obviously recognizes all comments as such. Is there a way to simply delete all?
Edit: Stat-R's bookmark method has helped greatly, not only for removing comments but for conditionally removing lines in general.
Warning to all using Stat-R's solution:
This method will remove lines of code if formatted like this:
Following his method, the entire line will be removed. Therefore make sure to go through and make these comments, their own line before doing this method.
As someone suggested in another post, the simplest and most reliable is maybe to export the all text in .RTF format using Menu Plugin-->NppExport-->Export to RTF and then:
-Open the newly created file in Word
-Select any part of any comment
-On the top-right side of Word clic Select--> Select all texts with similar formatting
-Remove the selected comments all at once (del or cut if doesn't work)
Enter ctrl+shift+K to remove comment
For a general file, first of all you need to know the comment operator of the language you are writing the file in. For example, in java script the comment operator is //. For the following code...
In NP++, you need to
Mark the lines that contains '//'. Make sure the bookmark option is enabled.
Then, choose from NP++ menu Search>Bookmark>Remove Bookmarked lines
EDIT: Another solution after @Chris Mirno 's suggestion is as follows: Use regular expression. See the image below. It is self explanatory
To understand it better, refer to these
To remove Powershell comments if someone find it handy:
Removing Comment in a Powershell using Notepad ++ To find just lines beginning with # (and not with # elsewhere in the line).
Regex ^[#}
enter image description here
You can select no comments just code by doing the following:
Regex ^[^#}
enter image description here
I have had some luck running a macro for the above. Basically:
//
(F3)Put
//
into the search dialog by just searching for it once. Then record the three steps in a macro, then play it back until EOF.The first time I did it I had a problem, but then it worked, not sure what I did differently.