note 16571 deleted from function.eregi-replace by jimw
| From: | jimw@php.net | Date: | Mon, 05 Nov 2001 00:53:24 +0000 |
| Subject: | note 16571 deleted from function.eregi-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20450@lists.php.net to get a copy of this message | ||
I spent hours trying to figure out how to strip "s from only inside the HTML tags which is
useful if you are previewing your HTML before it goes live from a form input. What I came up with is
the following. It may not be the best, but it's all I could come up with. It also replaces
"s not inside HTML tags with ".
while
(eregi("(<[^\"|>]*)\"([^\"|>]*)\"([^>]*>)",$body)){
$body =
eregi_replace("(<[^\"|>]*)\"([^\"|>]*)\"([^>]*>)","\\1\\2\\3",
$body);
} $body = eregi_replace("\"",""",$body);