note 16581 added to function.ereg-replace

From: Date: Mon, 05 Nov 2001 04:36:04 +0000
Subject: note 16581 added to function.ereg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-20453@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 &quot. while (ereg("(<[^\"|>]*)\"([^\"|>]*)\"([^>]*>)",$body)){ $body = ereg_replace("(<[^\"|>]*)\"([^\"|>]*)\"([^>]*>)","\\1\\2\\3", $body); } $body = ereg_replace("\"","&quot",$body); -- http://www.php.net/manual/en/function.ereg-replace.php http://master.php.net/manage/user-notes.php?action=edit+16581 http://master.php.net/manage/user-notes.php?action=delete+16581 http://master.php.net/manage/user-notes.php?action=reject+16581

« previous php.notes (#20453) next »