Elico has asked for the wisdom of the Perl Monks concerning the following question:

Hi, which regular expression I can use to delete all C-style coments from multiple files. Please advice, Cheers Eli

Replies are listed 'Best First'.
Re: regular expression to delete comments
by inman (Curate) on Jun 14, 2005 at 14:06 UTC
    Take a look at Regexp::Common. This has been tested over a wider range of data than you have to hand.

    Combine with File::Find if you need to locate the C files in a directory tree.

Re: regular expression to delete comments
by thundergnat (Deacon) on Jun 14, 2005 at 14:31 UTC

    Or, you could read the FAQ.

    perldoc -q comments

    and the first hit is "How do I use a regular expression to strip C style comments from a file?"

      Thank you it was very helpful
Re: regular expression to delete comments
by cog (Parson) on Jun 14, 2005 at 14:11 UTC