Strip multi-line (star) comments from JavaScript, while leaving any CDATA sections intact.
This regular expression removes multi-line (star) comments from JavaScript, while leaving any CDATA sections intact. Use the global (g) modifier to match them all (if you plan to use PHP's preg_replace, the g modifier is not necessary), and use the (s) modifier to make dots match newlines (this will...
Submitted by Dane MacMillan - 12 years ago