title: Email validation in js with space in the end
body: <p>I am using the following code for email validation, taken from <a href="http://jquerybyexample.blogspot.com/2011/04/validate-email-address-using-jquery.html" rel="nofollow">jQuery By Example</a>:</p>
  
  <pre class="lang-js prettyprint-override"><code>function validateEmail(sEmail) {
      var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
      if (filter.test(sEmail)) {
          return true;
      }
      else {
          return false;
      }
  }​
  </code></pre>
  
  <p>If I put space after entering the valid email then also its giving me invalid email.
  What can I do for that? Tried a lot but not getting the proper result.</p>