note 21304 added to function.strip-tags

From: Date: Tue, 07 May 2002 15:29:09 +0000
Subject: note 21304 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-30297@lists.php.net to get a copy of this message
to rid everything in between script tags, including the script tags, i use this. $description = ereg_replace("/<script[^>]*>[^<]+<\/script>/is", "", $description); it hasn't been extensively tested, but it works. also, i ran into trouble with a href tags. i wanted to strip out the url in them. i did this to turn an <a href="blah.com">welcome to blah</a> into welcome to blah (blah.com) $string = preg_replace('/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $string); -- http://www.php.net/manual/en/function.strip-tags.php http://master.php.net/manage/user-notes.php?action=edit+21304 http://master.php.net/manage/user-notes.php?action=delete+21304 http://master.php.net/manage/user-notes.php?action=reject+21304

« previous php.notes (#30297) next »