note 81806 added to function.preg-replace

From: Date: Fri, 14 Mar 2008 08:39:15 +0000
Subject: note 81806 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-137047@lists.php.net to get a copy of this message
i came across a function strip_attributes online, looking for a solution to strip attributes after using strip_tags i came up with a quick preg_replace to replace the function that'll remove any formatting (strip all attributes) from ALL tags within the html. i hope this helps somebody: //strip unwanted tags $allowedTags = '<p><span><b><u><i><strong><em>'; $str = strip_tags($str, $allowedTags); //remove all formatting from remaining tags $str = preg_replace('/(<[a-z0-9]+) [^>]*>/', '$1>', $str); ---- Server IP: 209.41.74.194 Probable Submitter: 69.255.248.48 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/81806 Del: integrated -- https://master.php.net/note/delete/81806/integrated Del: useless -- https://master.php.net/note/delete/81806/useless Del: bad code -- https://master.php.net/note/delete/81806/bad+code Del: spam -- https://master.php.net/note/delete/81806/spam Del: non-english -- https://master.php.net/note/delete/81806/non-english Del: in docs -- https://master.php.net/note/delete/81806/in+docs Del: other reasons-- https://master.php.net/note/delete/81806 Reject -- https://master.php.net/note/reject/81806 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137047) next »