in reply to Removing XML comments with regex
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"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Removing XML comments with regex
by tuxz0r (Pilgrim) on Oct 24, 2007 at 19:44 UTC |