Well, i thought about this for a second and came up with the following code:
function remove_comments ($search)
{
if(strstr($search,'<!'))
{
$start = strpos($search, '<!');
$comment = strstr($search, '<!');
$length = strpos($comment, '->') + 1;
$search = substr_replace($search, '', $start, $length);
// recursive function so that it continues removing comments untill there are none left.
$search = remove_comments ($search);
} else {
return $string;
}
}
$search= '<html> <!-- html comment --> <html>';
$search = remove_comments ($search);
// now you can check it for your text.
eregi($search, $text);
After about 30 minutes scratching my head over why it doesn't work, i started reading the user comments in the strstr section of the php manual where it states that since 4.2.3, the strstr function (among others) no longer work if the string contains the '<' character. I have not looked into this, but believe there will be a work around.
The above code should help you see how it could be done. You just need to find some functions that will work with the '<' char or write your own.