title: Invalid regular expression in HTML5 input pattern in email input
body: <p>I need to use this regular expression in a HTML input (Email Type), I used to create a regex here  to match what we wanted to validate <a href="http://regexr.com/3gib9" rel="nofollow noreferrer">http://regexr.com/3gib9</a></p>
  
  <p>Regex</p>
  
  <pre><code>/^([A-Z|a-z|0-9](\.|_){0,1})+[A-Z|a-z|0-9]\@([A-Z|a-z|0-9])+((\.){0,1}[A-Z|a-z|0-9]){2}\.(com|net|org|co|org)+((\.[A-Z|a-z|0-9]{2,4})?)$/gm
  </code></pre>
  
  <p>Pattern</p>
  
  <pre><code>^([A-Z|a-z|0-9](\.|_){0,1})+[A-Z|a-z|0-9]\@([A-Z|a-z|0-9])+((\.){0,1}[A-Z|a-z|0-9]){2}\.(com|net|org|co|org)+((\.[A-Z|a-z|0-9]{2,4})?)$
  </code></pre>
  
  <p>Element with Pattern</p>
  
  <pre><code>&lt;input type="email" pattern="^([A-Z|a-z|0-9](\.|_){0,1})+[A-Z|a-z|0-9]\@([A-Z|a-z|0-9])+((\.){0,1}[A-Z|a-z|0-9]){2}\.(com|net|org|co|org)+((\.[A-Z|a-z|0-9]{2,4})?)$" name="email" class="form-control" placeholder="email address" value="&lt;%= session("user_email_addr") %&gt;" required="required" title="Please input a valid email"&gt;
  </code></pre>
  
  <p>And now I am getting this error (Invalid Escape) when I input any email in the form</p>
  
  <pre><code>Pattern attribute value ^([A-Z|a-z|0-9](\.|_){0,1})+[A-Z|a-z|0-9]\@([A-Z|a-z|0-9])+((\.){0,1}[A-Z|a-z|0-9]){2}\.(com|net|org|co|org)+((\.[A-Z|a-z|0-9]{2,4})?)$ is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /^([A-Z|a-z|0-9](\.|_){0,1})+[A-Z|a-z|0-9]\@([A-Z|a-z|0-9])+((\.){0,1}[A-Z|a-z|0-9]){2}\.(com|net|org|co|org)+((\.[A-Z|a-z|0-9]{2,4})?)$/: Invalid escape
  </code></pre>
  
  <p>How can I made this work?</p>