note 26627 added to function.strip-tags

From: Date: Thu, 07 Nov 2002 07:18:42 +0000
Subject: note 26627 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-39089@lists.php.net to get a copy of this message
$html_tags = "a|b|i"; $text = preg_replace("'(<)+(/?.+>?)'i", "&lt;\\2", $text); $text = preg_replace("'(&lt;)+(/?\b($html_tags){1}\b>?)'i", "<\\2", $text); This works nice to escape undesireable html tags. However if anyone can merge those 2 regex into a single one it would be appreciated :) ------- My previous post should have been this, as tags like <z <? <% would not be escaped. -- http://www.php.net/manual/en/function.strip-tags.php http://master.php.net/manage/user-notes.php?action=edit+26627 http://master.php.net/manage/user-notes.php?action=delete+26627 http://master.php.net/manage/user-notes.php?action=reject+26627

« previous php.notes (#39089) next »