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
Removing comments from a file
Moderators: AmigoJack, bbadmin, helios, MudGuard
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
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.....
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.....
Hope this was helpful.............good luck,
Bob
Bob