in reply to a regex to parse html tags

You could perhaps try something with a negated character class:
$var =~ m%<HEAD>([^<]+)</HEAD%i; print $1, "\n";
The '^' at the beginning of the character class creates a negated character class, which essentially means:
"Match anything that is not <"

You could also use HTML::Parser and the like, however if you are only trying to match the <HEAD> tags then using the module might be unnecessary.

Amel - f.k.a. - kel