note 55622 deleted from function.preg-replace by tularis

From: Date: Sun, 18 Jun 2006 13:27:38 +0000
Subject: note 55622 deleted from function.preg-replace by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-114317@lists.php.net to get a copy of this message
Note Submitter: ---- 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.

« previous php.notes (#114317) next »