$string =<<'TEXT'; 1 The last company to fail was ISTF with losses of $60M. 2 The last company to fail was ITF with losses of $60M. 3 The last company to fail wasISTF with losses of $60M. < tr>4 The last company to fail was ISTF with losses of $60M. TEXT print "Found $1\n" while $string =~ m|<\s*tr\s*>([^<]*\bISTF\b[^<]*)<\s*/tr\s*>|gi;