in reply to string pattern match, limited to first 1000 characters?

(substr $str, 0, 1000) =~ /html/i;

DWIM is Perl's answer to Gödel