public static String bbParse(String s)
{
if (s == null)
return null;
s = s.replace("\r", "");
s = s.replaceAll("(\\s|\"|\'|\\(|^|\n)\\*(.*?)\\*(\\s|\"|\'|\\)|\\?|\\.|!|:|;|,|$|\n)", "$1<font color=\"LEVEL\">$2</font>$3"); // *S1*
s = s.replaceAll("(\\s|\"|\'|\\(|^|\n)\\$(.*?)\\$(\\s|\"|\'|\\)|\\?|\\.|!|:|;|,|$|\n)", "$1<font color=\"00FFFF\">$2</font>$3");// $S1$
s = s.replaceAll("%%\\s*\n", "<br1>");
s = s.replaceAll("\n\n+", "<br>");
s = replace(s, "\\[([^\\]\\|]*?)\\|([^\\]]*?)\\|([^\\]]*?)\\]", Pattern.DOTALL, "<button ALIGN=LEFT ICON=\"$1\" action=\"bypass -h $2\">$3</button>");
s = replace(s, "\\[([^\\]\\|]*?)\\|([^\\]]*?)\\]", Pattern.DOTALL, "<button ALIGN=LEFT ICON=\"NORMAL\" action=\"bypass -h $1\">$2</button>");
s = s.replaceAll(" @", "\" msg=\"");
return s;
}