my $idx = rindex($text, "Tags"); if ($idx > -1) { substr($text, $idx) = ''; }