How to save without comments?
Andrew Tommy last edited by
After doing a user language highlighting i would need an option to save the file WITHOUT comments i added.
Is is possible to add this option?
I tried to create a macro, but it didn’t recognize the comments (they are written between #, e.g. #this is a comment#).
Thanks in advance,
Scott Sumner last edited by Scott Sumner
It is certainly easy enough to get rid of your comments, but it seems as if you’d want to end up with TWO versions of your file–one with comments (your worked hard to put the comments in, why not retain them!), and one without comments. Thus it might be wise to do a “Save A Copy As…” or “Save As…” and then remove the comments from the copy.
As to removing the comments, a simple regular expression Replace-All operation should suffice:
Replace-with box: make sure this box is empty!
You didn’t say if your comments could span lines or not, so the regular expression allows this (the
(?s)part). Otherwise, the expression looks for a
#character, followed by one or more characters (the
.+?part), followed by another
#. It replaces any matches with nothing effectively deleting the comment.
You could record the Replace-All part as a macro, certainly. However, if you like the save-a-copy part, that doesn’t lend itself to macro-izing too well.
If this (or ANY) posting was useful, don’t post a “thanks”, just upvote ( click the
^ 0 varea on the right ).