in reply to Regex to strip comments
You could try this:
$t = 'fred /* bill "jack \" */ \xAB \t john\n" mick */ mary /* /* \u12 +ef */ jane';; ( $s = $t ) =~ s[(/\*(?:"(?:\\\\|\\[abfnrt]|\\u[0-9a-fA-F]{4}|\\x[0-9a +-fA-F]{2,4}|\\"|[^"])+?"|.)*?\*/)][]msg; print $s;; fred mary jane
There are probably some edge cases I've missed, but they should be fixable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to strip comments (out not in)
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 | |
by tye (Sage) on Oct 01, 2012 at 19:18 UTC | |
|