Page 1 of 1
Removing comments from a file
Posted: Mon Jun 08, 2009 6:37 pm
by wcboyd
Hello All,
I have a file with comments that span more than one line.
The comments start with /* and end with */
Is it possible to use the find/replace option to remove these multiline comments? Or perhaps a macro?
Thanks,
Craig
Posted: Mon Jun 08, 2009 10:39 pm
by Bob Hansen
TextPad RegEx cannot easily ready multiple lines. Ir there is a fixed number, some tricks can be done. But if the comments are all on the same line, even if word wrapped, these will work for you. A few different possibilities:
Text:
/* These are comments, and this is more and this continues and does a word wrap on to the next line and finally ends with closing symbols on the next line.
*/
Search for: /\*.*\n\*/
Replace with nothing.
==========================
Text:
/*
These are comments, and this is more and this continues and does a word wrap on to the next line and finally ends with closing symbols on the next line.
*/
Search for: /\*\n.*\n\*/
Replace with nothing.
===============================
Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------
I think that you can use Wild Edit to remove the comments when there are random quantity of mulltiple lines of comments. Cannot test that out now.....