On Thu, May 06, 2004 at 11:48:36PM -0400, Paul Chvostek wrote:
> On Thu, May 06, 2004 at 07:11:55PM +0000, Curt Zirzow wrote:
> > > 
> > >  $text="one <!--bleh\nblarg -> two\n";
> > >  print ereg_replace("<!--([^-][^-]?[^>]?)*-->", "",$text);
> > 
> > Because your missing a -
> > $text="one <!--bleh\nblarg --> two\n";
> 
> /me applies mallet to head
> 
>  % php -r '$text="one <!--bleh\nblarg --> two\n"; print 
> ereg_replace("<!--([^-][^-]?[^>]?)*-->", "",$text);'
>  one  two
> 
> whee, it works!  :)
> 

you're still missing things like <!------------ START ------------->...
don't know how you can get around that with ereg.

also preg_replace('/<!--.*?-->/s', ...) is much faster. :-)

- rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to