[svn:perlfaq] r7910 - perlfaq/trunk
[email protected] Sat, 7 Oct 2006 13:38:55 -0700 (PDT)
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
Author: comdog
Date: Sat Oct 7 13:38:54 2006
New Revision: 7910
Modified:
perlfaq/trunk/perlfaq6.pod
Log:
* How do I use a regular expression to strip C style comments from a file?
+ added note that the C++ comment stripper won't work if
the comment is spread over multiple lines
Modified: perlfaq/trunk/perlfaq6.pod
==============================================================================
--- perlfaq/trunk/perlfaq6.pod (original)
+++ perlfaq/trunk/perlfaq6.pod Sat Oct 7 13:38:54 2006
@@ -422,7 +422,8 @@
)
}{defined $2 ? $2 : ""}gxse;
-A slight modification also removes C++ comments:
+A slight modification also removes C++ comments, as long as they are not
+spread over multiple lines using a continuation character):
s#/\*[^*]*\*+([^/*][^*]*\*+)*/|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#defined $2 ? $2 : ""#gse;