title: JavaScript differences beetween new Regex('regex', 'flags') and /regex/flags
body: <pre><code>var a = 'toto titi (should be removed) 5'.replace(/\(.*\)|\[.*\]|[^a-zA-Z0-9 ]|tata|tutu|tyty/gi, '!$!');
  var b = 'toto titi (should be removed) 5'.replace(new RegExp('\(.*\)|\[.*\]|[^a-zA-Z0-9 ]|tata|tutu|tyty', 'gi'), '!$!');
  console.log(a);
  console.log(b);
  </code></pre>
  
  <p>I want to replace by space every char which is not a number or a letter or a space and chars which are beetween () and []. 
  I have 2 same sentences, and I use the same pattern. The only one difference is that I use the <code>/regex/flags</code> syntax for <code>var a</code> and the object syntax <code>new Regex('regex','flags')</code> for <code>var b</code>.</p>
  
  <p>However the result is not the same for a and for b.</p>
  
  <p>Output is :</p>
  
  <pre><code>toto titi !$! 5 //a (it's the expected result)
  !$!!$!          //b
  </code></pre>
  
  <p>I don't understand why. Could you explain me ?
  I have to use the object syntax because I need to build my regex with variables.</p>