The regex is pretty difficult for these, but so useful that it is inclued in
the perl FAQ!
Here it for you pleaseure . Perl style
$/ = undef;
$_ = <>;
s#/\*[^*]*\*+([^/*][^*]*\*+)*/|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)#
$2#gs
print;
There is a commented (legible) version in the faq (part 6?) for those with
interest,
+ modification for c++ sytle comments
Justin MacCarthy
>-----Original Message-----
>From: ilug-admin at linux.ie [mailto:ilug-admin at linux.ie]On Behalf Of
>Michael Turley
>Sent: Thursday, December 07, 2000 8:08 PM
>To: ilug at linux.ie>Subject: [ILUG] strip comments utility
>>>Does anyone know of a utility to strip C style (/* */)
>comments from code. I have a rake of stuff with alot
>of CVSg material which I would like to remove. Does
>CVS have this type of functionality?
>>=====
>Mr. Michael Turley
>Gracious winner, Generous lover, All round great guy.
>>__________________________________________________
>Do You Yahoo!?
>Yahoo! Shopping - Thousands of Stores. Millions of Products.
>http://shopping.yahoo.com/>>--
>Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
>List maintainer: listmaster at linux.ie>>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!