note 55622 added to function.preg-replace

From: Date: Tue, 09 Aug 2005 07:32:04 +0000
Subject: note 55622 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-93285@lists.php.net to get a copy of this message
Example 1. Convert HTML to text just work in <b>valid </b> HTML tags. You need little adjustion to process <b>invalid </b> HTML tags, such as unclosed tags. simply add <? '@<[\/\!]*?[^<>]*?@si', // Strip out invalid HTML tags ?> after the <? '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags ?> and add ''(blank) on the related $replace array. Your $search string should look like this : <? '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@<[\/\!]*?[^<>]*?@si', // Strip out invalid HTML ?> WARNING: Put the invalid tags search string AFTER the valid tags search string. ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55622 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55622&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55622&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55622&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55622&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55622&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55622&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55622&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93285) next »