well i heard preg_replace is a very hard thing in php but i thought i would give a swing at it, i did with a simple phrase already and it worked great but i cant get this one to work with variables and what nots..
heres my error:
Quote:
Originally Posted by server
Warning: Compilation failed: missing terminating ] for character class at offset 21 in /home2/animati/public_html/dev/testphp.php on line 24
|
my php
PHP Code:
$string= "[bold]black[/bold]";
$pattern= "#/[bold\](.*)\[/bold\]#esiU";
$replace= "<b>$1</b>";
echo preg_replace($pattern, $replace, $string);