title: how to use a variable in RegExp with search method in Javascript?
body: <p>I have a string:</p>
  
  <pre><code>var _codes = "1234,1414,5555,3333,2222,5566,4545";
  var regex = new RegExp(/1234/i);
  var _found = _codes.search(regex);
  
  //this works sofar. 
  </code></pre>
  
  <p>nowi  want to do it with variable:</p>
  
  <p>like this: </p>
  
  <pre><code>var id = "1234";
  regex = new RegExp("\\"+id+"\\/i");
  </code></pre>
  
  <p>but it doesn't work. any ideas?</p>
  
  <p>Thanks!</p>