* Thus wrote Paul Chvostek ([EMAIL PROTECTED]):
> On Thu, May 06, 2004 at 11:26:34AM -0400, Rob Ellis wrote:
> > >
> > > $text = ereg_replace("<!--[^>]*-->","",$text);
> >
> > you can make the .* less greedy...
> >
> > $text = preg_replace('/<!--.*?-->/', '', $text);
>
> Interestingly, from a shell:
>
> $ text='one <!-- bleh --> two\nthree <!-- blarg -->four\n'
> $ printf "$text" | sed -E 's/<!--([^-][^-]?[^>]?)*-->//g'
> one two
> three four
>
> which is the same behaviour as PHP. But that still doesn't cover
> multi-line. PHP's ereg support is supposed to, but doesn't work with
> this particular substitution:
>
> $text="one <!--bleh\nblarg -> two\n";
> print ereg_replace("<!--([^-][^-]?[^>]?)*-->", "",$text);
Because your missing a -
$text="one <!--bleh\nblarg --> two\n";
^^^
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php