use MT::Sanitize; my $html = <<HTML; <a name="foo.html" onclick="evilJS()">foolink</a> HTML my $str = MT::Sanitize->sanitize($html, 'a href'); ## $str is now <a href="foo.html">foolink</a>