rendered paste bodyfunction bb2html($str){ $str = htmlspecialchars($search, ENT_NOQUOTES); $find = array('#\[ *b *\](.+)\[ */b *\]#is', '#\[ *i *\](.+)\[ */i *\]#is', '#\[ *u *\](.+)\[ */u *\]#is', '#\[ *s *\](.+)\[ */s *\]#is', '#\[ *(colou?r) *= *#([a-f0-9]{3}|[a-f0-9]{6}) *\](.+)[ *\1 *\]#is', '#\[ *quote *\](.+)\[ */quote *\]#is'); $replace = array('<b>\1</b>', '<i>\1</i>', '<u>\1</u>', '<s>\1</s>', '<span style="color: #\2">\3</span>', '<table width="100%" bgcolor="lightgray"><tr><td bgcolor="white">\1</td></tr></table>'); $str = preg_replace($find, $replace, $str); return $str;}