title: Passing regex modifier options to RegExp object
body: <p>I am trying to create something similar to this:</p>
  
  <pre><code>var regexp_loc = /e/i;
  </code></pre>
  
  <p>except I want the regexp to be dependent on a string, so I tried to use new RegExp but I couldn't get what i wanted.</p>
  
  <p>Basically I want the <code>e</code> in the above regexp to be a string variable but I fail with the syntax.</p>
  
  <p>I tried something like this:</p>
  
  <pre><code>var keyword = "something";
  
  var test_regexp = new RegExp("/" + keyword + "/i");
  </code></pre>
  
  <p>Basically I want to search for a sub string in a larger string then replace the string with some other string, case insensitive.</p>
  
  <p>regards,
  alexander</p>