str=str.replace(/(\[b\])(.*)(\[\/b\])/gi,"<b>$2</b>");ubb代码替换。
将形如:this is a string
替换成:<b>this is a string</b>就是加粗功能。