title: jQuery Validate method checking for special characters
body: <p>I am trying (and failing) to write a regular expression statement that checks for special characters such as !@#$%^&amp;*()_+&lt;>?'"{}[] in my Javascript form validation.</p>
  
  <p>I understand that this has probably been asked 1000 times but i'm under some serious time pressure. If you would rather not answer the question below and you are able to point me in the direction of a previous answer to the above question I would greatly appreciate it.</p>
  
  <p>On a similar note, can anyone tell me why the following is shooting an error when I enter lowercase 'abc', etc? I'm baffled.</p>
  
  <pre><code>jQuery.validator.addMethod("specialChars", function( value, element ) {
          var regex = new RegExp("^[a-zA-Z0-9]+$");
          var key = String.fromCharCode(event.charCode ? event.which : event.charCode);
  
          if (!regex.test(key)) {
             event.preventDefault();
             return false;
          }
      }, "please use only alphanumeric or alphabetic characters");
  </code></pre>