PHP:
function bbcode($text){
$text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text); //заменяме bbcode [b]текст[/b] с html-а <b>текст</b>... надолу се прави абсолютно същотото за всеки bbcode
$text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text);
$text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text);
$text=preg_replace("/\[l\](.+?)\[\/l\]/s", '<div style="text-align:left;">$1</div>',$text);
$text=preg_replace("/\[c\](.+?)\[\/c\]/s", '<div style="text-align:center;">$1</div>',$text);
$text=preg_replace("/\[r\](.+?)\[\/r\]/s", '<div style="text-align:right;">$1</div>',$text);
$text=preg_replace("/\[j\](.+?)\[\/j\]/s", '<div style="text-align:justify;">$1</div>',$text);
$text=preg_replace("/\[s\](.+?)\[\/s\]/s", '<strike>$1</strike>',$text);
$patterns = array(
'/\[url\=(.*?)\](.*?)\[\/url\]/is',
'/\[img\=(.*?)\](.*?)\[\/img\]/is',
'/\[url\](.*?)\[\/url\]/is',
'/\[img\](.*?)\[\/img\]/is',
'/((^http|https)(\S+))/is'
);
$replaces = array(
'<a href="$1" target="_blank">$2</a>',
'<a href="$1" target="_blank"><img src="$2" target="_blank" rel="lightbox"/></a>',
'<a href="$1" target="_blank">$1</a>',
'<a href="$1" rel="lightbox"><img src="$1" rel="lightbox"/></a>', // sa samo tva ostana ;f
'<a href="$1" target="_blank">$1</a>'
);
$text = nl2br(preg_replace($patterns, $replaces, $text));
$text=preg_replace("/\[list=un\](.+?)\[\/list\]/s", '<ul>$1</ul>',$text);
$text=preg_replace("/\[list=or\](.+?)\[\/list\]/s", '<ol>$1</ol>',$text);
$text=preg_replace("/\[\*\](.+?)\[\/\*\]/s", '<li>$1</li>',$text);
$text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Цитат:</td></tr><tr><td width="100%" style="background-color:#CCCCFF;border:solid 1px white">$1</td></tr></table>',$text);
$text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="background-color:#CCCCFF;border:solid 1px white">$2</td></tr></table>',$text);
$text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1px;">$2</span>',$text);
$text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="80%"><tr><td><a >Code:</a></td></tr><tr><td width="80%" style="background-image:url(images/paperbg.gif);border:solid 1px white">$1</td></tr></table>',$text);
}
Ето ми го кода, но не можах да го наглася с "highlight_string" ако може да помогнете ;(