Re: Re: strip comments from HTML?
| From: | Justin French | Date: | Fri, 07 May 2004 01:52:08 +0000 |
| Subject: | Re: Re: strip comments from HTML? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185580@lists.php.net to get a copy of this message | ||
Thanks to everyone who's replied... appears to be quite a tricky one!!
$text = preg_replace('/<!--.*-->/su','',$text);
Did not work (was too greedy, matched multiple comments)
$text = preg_replace('/<!--.*?-->/','',$text);
Did not work (needed multiple lines)
$text = preg_replace('/<!--.*?-->/su','',$text);
Does work so far, finger's crossed.
Thanks again to John, Paul, Rob, Tom, et al.
---
Justin French
http://indent.com.au