Evo ti dio koda što ja koristim:
Code:
function BBdecode($text) {
$text=str_replace("\n","<br>\n", $text);
$text=preg_replace('/\[list=(a|1)\]((.|\n)*)\[\/list\]/U',"<ol type=\"\\1\">\\2</ol>",$text); /* ne dozvoljava ugniježdene liste */
$text=str_replace("[*]","<li>",$text);
$text=str_replace("[b]","<span style=\"font-weight: bold\">",$text);
$text=str_replace("[/b]","</span>",$text);
$text=str_replace("[i]","<span style=\"font-style: italic\">",$text);
$text=str_replace("[/i]","</span>",$text);
$text=str_replace("[u]","<span style=\"text-decoration: underline\">",$text);
$text=str_replace("[/u]","</span>",$text);
$text=preg_replace('/\[color=(\#[0-9a-fA-F]{1,6})\]/',"<span style=\"color: \\1\">",$text);
$text=str_replace('[/color]','</span>',$text);
return $text;
}
"I'd take the awe of understanding over the awe of ignorance any day."
- Douglas Adams