title: How to stringify regex?
body: <p>I have a following regex which chekcks if input is an email:</p>
  
  <pre><code>/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/
  </code></pre>
  
  <p>And I would like to stringify it in javascript. I was trying to use:</p>
  
  <pre><code>var regex = new RegExp("/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/");
  regex.toString();
  </code></pre>
  
  <p>but this yields me with the wrong result:</p>
  
  <pre><code>/\/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,6}$\//
  </code></pre>
  
  <p>Any ideas?</p>