in reply to Tricky regexp...

You could replace occurances of "webmaster" that are not proceeded by a "mailto:" with look behind assertion like this:
$html =~ s#(?<!mailto:)(webmaster)#<htmlcode>$1</htmlcode>#gs;

for anything less specific than that you should use a module to parse html.