http://qs1969.pair.com?node_id=646982


in reply to Removing XML comments with regex

Is this good enough ?
while (<>) { $line=$_; chomp $line; $StartTag='<!--'; $EndTag='-->'; if (($line =~ m/\Q$StartTag\E/) .. ($line =~ m/\Q$EndTag\E/)){ $Flag=0; } elsif (($line =~/<!--/) || ($line =~/-->/)){ $Flag=0; } else { $Flag=1; } if($Flag){ print "$line\n"; } }
(: Life is short enjoy it :)