Siccome ho una priorità, preferisco prima completare il parser bbcode:
ora sto usando questo codice:
Codice PHP:
function bb2html($bbcode){
/*
*
*       bbCode Parser
*
*       Syntax: bbcodeParser(bbcode)
*/

/*
Commands include
* bold
* italics
* underline
* typewriter text
* strikethough
* images
* urls
* quotations
* code (pre)
* colour
* size
*/

/* Basically remove HTML tag's functionality */
$bbcode htmlspecialchars($bbcode);

$spazio "\\n";
$spaziohtml "</br>";
$bbcode str_replace($spazio$spaziohtml$bbcode);

/* Matching codes */
$urlmatch "([a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+)";

$match["special"] = "/\?/s";
$replace["special"] = '?';

/* Bold text */
$match["b"] = "/\[b\](.*?)\[\/b\]/is";
$replace["b"] = "[b]$1[/b]";

/* Italics */
$match["i"] = "/\[i\](.*?)\[\/i\]/is";
$replace["i"] = "[i]$1[/i]";

/* Underline */
$match["u"] = "/\[u\](.*?)\[\/u\]/is";
$replace["u"] = "<span style=\"text-decoration: underline\">$1</span>";

/* Images */
$match["img"] = "/\[img\]".$urlmatch."\[\/img\]/is";
$replace["img"] = "<img src=\"$1\" />";

/* Links */
$match["url"] = "/\[url=".$urlmatch."\](.*?)\[\/url\]/is";
$replace["url"] = "<a href=\"$1\">$2</a>";

$match["surl"] = "/\[url\]".$urlmatch."\[\/url\]/is";
$replace["surl"] = "<a href=\"$1\">$1</a>";

/* youtube */
$match["youtube"] = "/\[youtube\](.*?)\[\/youtube\]/is";
$replace["youtube"] = "".parse_youtube_url("$1",'embed',585,315);

/* Parse */
$bbcode preg_replace($match$replace$bbcode);

/* New line to 
 tag */
$bbcode=nl2br($bbcode);

/* Return parsed contents */
return $bbcode;

Purtroppo la funzione preg_replace() mi "perde" il ? e devo sostituirlo con il relativo carrattere speciale html:
Codice PHP:
$match["special"] = "/\?/s";
$replace["special"] = '?'
Ora io verrei fare in modo che la perdita non avvenisse perche gli url non funzionano piu.
Chi mi aiuta?