Re: Re: strip comments from HTML?
| From: | John W. Holmes | Date: | Thu, 06 May 2004 15:33:31 +0000 |
| Subject: | Re: Re: strip comments from HTML? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185535@lists.php.net to get a copy of this message | ||
From: "Rob Ellis" <rob@web.ca>
> you can make the .* less greedy...
>
> $text = preg_replace('/<!--.*?-->/', '', $text);
You still need an 's' modifier if you want to match multi-line comments. The
dot character won't match newlines unless you use an 's' modifier.
---John Holmes...