I'm using the following regular expression to strip HTML comments <!-- example --> from an HTML file:
eregi_replace("<!--(-->)*-->","",$html);
The expression basically, and simply, says: Look for "<!--", then any text NOT "" equalling "-->" (and any amount of it "*") and then look for "-->" - when you find it, replace it with null "".
Easy, anything between an opening and closing comment tag that does not equal the closing comment tag itself is replaced.
But this doesn't WORK! WHY!? Does anybody have a more reliable comment stripping regexp?
Thanx in advance,
Baud Barf