note 21579 added to function.ereg-replace
| From: | cns at free dot fr | Date: | Fri, 17 May 2002 20:51:27 +0000 |
| Subject: | note 21579 added to function.ereg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30772@lists.php.net to get a copy of this message | ||
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 !
--
http://www.php.net/manual/en/function.ereg-replace.php
http://master.php.net/manage/user-notes.php?action=edit+21579
http://master.php.net/manage/user-notes.php?action=delete+21579
http://master.php.net/manage/user-notes.php?action=reject+21579