A good UBB coding function implemented in JavaScript: function JsUBB (str)
{
Var re = // [I/] (. [^/[] *)/[// I/]/gi;
Str = str. replace (re ,"
$1"); // Italics
Re = // [B/] (. [^/[] *)/[// B/]/gi;
Str = str. replace (re ,"
$1"); // Bold
Re = // [u/] (. [^/[] *)/[// u/]/gi;
Str = str. replace (re ,"
$1"); // Underline
Re = // [color = (. [^/[] *)/] (. [^/[] *)/[// color/]/gi;
Str = str. replace (re, "$2"); // font color
Re = // [size = ([1-7])/] (. [^/[] *)/[// size/]/gi;
Str = str. replace (re, "$2"); // font size
Re = // [face = (. [^/[] *)/] (. [^/[] *)/[// face/]/gi;
Str = str. replace (re, "$2"); // font
Re = // [center/] (. [^/[] *)/[// center/]/gi;
Str = str. replace (re ,"
$1
"); // Center
Re = // [right/] (. [^/[] *)/[// right/]/gi;
Str = str. replace (re ,"
$1
"); // Right alignment
Re = // [quote/] (. [^/[] *)/[// quote/]/gi; // reference
Str = str. replace (re ,"
");
Re = // [fly/] (. *)/[// fly/]/gi; // flight
Str = str. replace (re ," $1 ");
Re = // [move/] (. *)/[// move/]/gi; // move
Str = str. replace (re ," $1 ");
Re = // [SHADOW = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *)/] (. [^/[] *)/[// SHADOW]/gi; // SHADOW
Str = str. replace (re ,"
");
Re = // [GLOW = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *)/] (. [^/[] *)/[// GLOW]/gi; // outshines
Str = str. replace (re ,"
")
Re = // [URL/] (. [^/[] *)/[// URL/]/gi;
Str = str. replace (re, "$1"); // hyperlink 1
Re = // [URL = (. [^/[] *)/] (. [^/[] *)/[// URL/]/gi;
Str = str. replace (re, "$2"); // hyperlink 2
Re = // [EMAIL/] ([/w-] + (/. [/w-] +) * @ [/w-] + (/. [/w-] +)/[// EMAIL/]/gi;
Str = str. replace (re, "$1"); // email link 1
Re = // [EMAIL = ([/w-] + (/. [/w-] +) * @ [/w-] + (/. [/w-] +)/] (. [^/[] *)/[// EMAIL/]/gi;
Str = str. replace (re, "$4"); // email link 2
Re = // [img/] (. [^/[] *)/[// img/]/gi;
Str = str. replace (re, ""); // picture
Re =/: em (/d {1,}):/gi;
Str = str. replace (re, ""); // emoticon icon
Return str;
}