title: Regular expression using struts not working
body: <p>This is code for Email validation,here i have doubt is that regular expression correct or not..and one more explain each statement here what e.which represents here....like that i want to know each statement....</p>
  
  <pre><code>     function mailonly(e){
          var code;
          if (!e) var e = window.event;
          if (e.keyCode) code = e.keyCode;
          else if (e.which) code = e.which;
          var character = String.fromCharCode(code);
              var AllowRegex = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
              if (AllowRegex.test(character)) return true;
              return false;}
  </code></pre>