title: Unmatched ) in Javascript regular expression
body: <p>May be you can help me: 
  My javascript code:</p>
  
  <pre><code>bbchatdecode: function(text) {  
  
  var chars = Array(":\\)","8-\\)",":cry:",":oops:");
  var replacements = Array('&lt;img src=\"smiley-smile.gif\" alt=\":)\"&gt;','&lt;img src=\"smiley-cool.gif\" alt=\"8-)\"&gt;','&lt;img src=\"smiley-cry.gif\" alt=\":cry:\"&gt;','&lt;img src=\"smiley-embarassed.gif\" alt=\"oops:\"&gt;');
  for (var ic=0; ic&lt;chars.length; ic++) {
    var re = new RegExp(chars[ic], "gi");
    if(re.test(text))
    {
     text = text.replace(re, replacements[ic]);
    }
  }
  return text;
  }   
  </code></pre>
  
  <p>But in the browser I can see:</p>
  
  <p>unmatched <code>)</code> in regular expression</p>