title: Javascript RegExp object adding characters
body: <p>I have a regex string that is getting passed into to my code, when I try to inject it into the RegExp object constructor, the RegExp object appears to be adding characters.</p>
  
  <p>original string regex:  </p>
  
  <pre><code>    /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/
  </code></pre>
  
  <p>After calling new RegExp(mystring); results in the following:</p>
  
  <p>regex:</p>
  
  <pre><code>    /\/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$\//
  </code></pre>
  
  <p>I can't hardcode the string in my js file, so I need a way to make this work.</p>