preg_replace help!

From: Date: Wed, 03 May 2006 21:25:57 +0000
Subject: preg_replace help!
Groups: php.db 
Request: Send a blank email to php-db+get-41806@lists.php.net to get a copy of this message
Hey, I need some help. I am trying to parse a forum post using php, but it parses it everytime it sees the letter, not the thing in quotes. Any help? function bbcodereplace($subject){ // $document should contain an HTML document. // This will remove HTML tags, javascript sections // and white space. It will also convert some // common HTML entities to their text equivalent.
$search = array ("[b]",        // Bold
                "[u]",               // Underline
                "[i]",                    // Italics
                "[/b]",                   // Bold Close
                "[/u]",       // Underline Close
                "[/i]");       // Italics Close
//                 '@&(gt|#62);@i',
//                 '@&(nbsp|#160);@i',
//                 '@&(iexcl|#161);@i',
//                 '@&(cent|#162);@i',
//                 '@&(pound|#163);@i',
//                 '@&(copy|#169);@i',
//                 '@&#(\d+);@e');                    // evaluate as php
$replace = array ('<b>',
                '<u>',
                '<i>',
                '</b>',
                '</u>',
                '</i>');
//                 '>',
//                 ' ',
//                 chr(161),
//                 chr(162),
//                 chr(163),
//                 chr(169),
//                 'chr(\1)');
return preg_replace($search, $replace, $subject); } PLEASE NOTE: This is for a phpBB forum, not vBulliten or InvisionPowerBoard


« previous php.db (#41806) next »