function parse($text) {
$text = nl2br($text);
$text = preg_replace('/\[url=(.+?)\](.+?)\[\/url\]/is', '${2}', $text); // [URL=http://mysite.com]check out my site[/URL]
$text = preg_replace('/\[b\](.+?)\[\/b\]/is', '${1}', $text); // [b] this text is bold[/b]
$text = preg_replace('/\[u\](.+?)\[\/u\]/is', '${1}', $text); // [u] this text is underlined[/u]
$text = preg_replace('/\[i\](.+?)\[\/i\]/is', '${1}', $text); // [i] italic text[/i]
$text = preg_replace('/\[img=(.+?)\]/is', '
', $text); // [img=http://www.image.url]
$text = preg_replace('/\[right\](.+?)\[\/right\]/is', '
${1}
', $text); // [right] text to be aligned to the right[/right]
$text = preg_replace('/\[left\](.+?)\[\/left\]/is', '${1}
', $text); // [left] text to be aligned to the left[/elft]
$text = preg_replace('/\[center\](.+?)\[\/center\]/is', '${1}', $text); // [center] text to be centred on the page[/center]
$text = preg_replace('/\[color=(.+?)\](.+?)\[\/color\]/is', '${2}', $text); // [color=(red|white|blue|etc)] color this text[/color]
$text = preg_replace('/\[size=([1-5])\](.+?)\[\/size\]/is', '${2}', $text); // [size=(1-5)] change the size of the text based on the tag, 1 being largest, 5 being smallest[/size]
$text = preg_replace('/\[font=(.+?)\](.+?)\[\/font\]/is', '${2]', $text); // [font=arial] I want this text written in arial[/font]
$text = preg_replace('/\[pic=(.+?)\]/is', '
', $text); // [pic=Quest_pic_3] On site uploaded images used with the quick access uploader
$text = preg_replace('/\[hide=(.+?)\|(.+?)\](.+?)\[\/hide\]/is', '${2}
${3}
', $text); // [hide=map|Showtext][IMG=url.to.map.png][/hide] to make "Map" a quicklink to expand showing the map, but otherwise hiding the map.
$text = preg_replace('/\[item=(.+?)\]/is', '
', $text); //[item=santa hat] Will pull an item of a santa hat from the item database.
return $text;
}