UBB codes are just markers for php/perl or whatever the script is written in, compareable to html-tags.
a script to replace these UBB codes or tags could look like this: (Probably this board will mess the code up... but why not give it a try π )
#---- START ----
$text = preg_replace("/[URL=HTTP:\/\/(.)](.)[\/URL]/Usi","<a href=\"http://\1\" target=\"_blank\">\2</a>",$text);
$text = preg_replace("/[URL=(.)](.)[\/URL]/Usi","<a href=\"http://\1\" target=\"_blank\">\2</a>",$text);
$text = preg_replace("/[URL]HTTP:\/\/(.)[\/URL]/Usi","<a href=\"http://\1\" target=\"_blank\">\1</a>",$text);
$text = preg_replace("/[URL](.)[\/URL]/Usi","<a href=\"http://\1\" target=\"_blank\">\1</a>",$text);
$text = preg_replace("/[EMAIL](.)[\/EMAIL]/Usi", "<a href=\"mailto:\1\" target=\"_blank\">\1</a>", $text);
$text = preg_replace("/[IMG]HTTP:\/\/(.)[\/IMG]/Usi","<img src=\"http://\1\">",$text);
$text = preg_replace("/[IMG](.)[\/IMG]/Usi","<img src=\"http://\1\">",$text);
$text = preg_replace("/[B](.)[\/B]/Usi","<b>\1</b>", $text);
#------ END ------
this would replace codes like ie
title of the page
to
<a href="http://dont.know.wat/somepage.htm" target="blank">title of the page</a>
or
title of the page
to
<a href="somepage.htm" target="blank">title of the page</a>
and some others [EMAIL] [IMG] ...
more can of course also be added, but these should be enough as example π