Help for this page
#!/usr/bin/perl use strict; ... $string =~ s/<tr.+?NOTWANTED.+?<\/tr>//gsm; print $string;
my @tr = split(/(?=<tr)/, $string); # split at <tr, but do not remove +<tr @tr = grep { ! /NOTWANTED/ } @tr; # remove the elements with NOTWANT +ED print join('', @tr);