in reply to Removing '//' comments
use warnings; use Regexp::Common qw /comment/; while(<DATA>){ my ($line, $simple, $RE, $tye) = ($_)x4; $simple =~ s#//[^\n]*$##s; $RE =~ s#$RE{comment}{Portia}#\n#; $tye =~ s# (^ (?: [^/'"]+ | '([^'\\]+|\\.)*' | "([^"\\]+|\\.)*" | (?<!/)/(?!/) )* ) //.* #$1#xgm; print " [DATA] $line"; print "[simple] $simple"; print " [RE] $RE"; print " [tye] $tye"; print "\n"; } __DATA__ blah // comment /* // */ /* */ *str = "//\"//";
|
|---|