I have a problem with the preg_replace function, I am trying to convert some bbcode into HTML but it is not working.
The one that I am trying to get to work is [size=200:37pfziz0][TEXT][/size:37pfziz0]
(not sure why those numbers appear there but they need to be taken into consideration. So I am trying to do [size=(1):(2)](3)[/size:(4)]
I tried it with both eregi and preg and both don't seem to work:
$txt = eregi_replace("\\[size=([^\\[]+):([^\\[]+)\\]([^\\[]*)\\[/size:([^\\[]+)\\]", "<font size=\"\\1\%\">\\3</font>", $txt);
$txt = preg_replace("#\[size\=(.*?):(.*?)\](.*?)\[/size:(.*?)\]#is", "<font size=\"\\1\%\">\\3</font>", $txt);
Can anybody tell me what I am doing wrong? I spent about an hour on doing quotes, which eventually came out fine using this method:
$txt = preg_replace("#\[quote\=(.*?):(.*?)\](.*?)\[/quote:(.*?)\]#is", "<blockquote>Quote by: \\1<br/>\\3</blockquote>", $txt);