note 21579 deleted from function.ereg-replace by kennyt
| From: | kennyt@php.net | Date: | Wed, 26 Jan 2005 03:56:02 +0000 |
| Subject: | note 21579 deleted from function.ereg-replace by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83993@lists.php.net to get a copy of this message | ||
Note Submitter: cns at free dot fr
----
If you wish to remove/get all the comments from a HTML string I think that this reg. ex. could come
in handy :
'<!--([^-]*([^-]|-([^-]|-[^>])))*-->'
That is :
* the string delimited by <!-- and --> contains no '-' sign
* or if it does, the next character is not a '-'
* or if it is, the next one is not a '>'
This should deal with all possible cases.
Enjoy !