Msg#: 3500273 posted 6:38 pm on Nov 9, 2007 (gmt 0)
Your bbcode array should contain RegExp values, not string values. Try this:
var bbcode = [/\(b\)/gi, /\(\/b\)/gi];
The first pattern: /\(b\)/gi That says match the literal '(' followed by a 'b' followed by a literal ')', and the 'g' attribute makes it 'Global' (matches all instances). The 'i' attribute will make it case-insensitive, so you could do:
(b)bold(/b) (B)bold(/B) (b)bold(/B)
and you'd end up with:
<b>bold</b> <b>bold</b> <b>bold</b>
The second pattern: /\(\/b\)/gi That says match the literal '(' followed by the literal '/' followed by 'b' followed by the literal ')'. Again, the 'g' makes it global and the 'i' makes it case insensitive.