zuma53 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to remove block comments of the /* comment */ kind.
I've gulped the file into one string and have removed the block comments by using:
$TEXT =~ s/\/\*(.*?)\*\///g
This works most of the time, until, you guessed it, there's an embedded text string with a innocuous '/*' or '*/' somewhere which gums up the regex.
This has probably been asked and answered a thousand times over already, but I have not found a working solution.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex to strip comments
by jwkrahn (Abbot) on Oct 01, 2012 at 00:26 UTC | |
|
Re: Regex to strip comments (match strings)
by tye (Sage) on Oct 01, 2012 at 04:31 UTC | |
|
Re: Regex to strip comments
by GrandFather (Saint) on Oct 01, 2012 at 00:36 UTC | |
|
Re: Regex to strip comments
by clueless newbie (Curate) on Oct 01, 2012 at 01:01 UTC | |
|
Re: Regex to strip comments
by BrowserUk (Patriarch) on Oct 01, 2012 at 00:39 UTC | |
by tye (Sage) on Oct 01, 2012 at 04:35 UTC | |
by BrowserUk (Patriarch) on Oct 01, 2012 at 05:31 UTC | |
by tye (Sage) on Oct 01, 2012 at 14:53 UTC | |
by BrowserUk (Patriarch) on Oct 01, 2012 at 18:20 UTC | |
| |
|
Re: Regex to strip comments
by kcott (Archbishop) on Oct 01, 2012 at 00:39 UTC | |
by zuma53 (Beadle) on Oct 01, 2012 at 02:20 UTC | |
by kcott (Archbishop) on Oct 01, 2012 at 21:39 UTC |