title: Email address regular expression with max length
body: <p>I have a regular expression that I am using for client side HTML5 validation and I need to add a max length element to it.  Here is my regular expression : </p>
  
  <pre><code>@pattern = @"^([a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)$"
  </code></pre>
  
  <p>How would I for example limit it to 50 characters?</p>
  
  <p>EDIT : I need to check the max length in the same regular expression as I am using HTML5 validation which only currently allows checking against required and pattern attributes.</p>