title: jquery test function not running properly
body: <p>I am using jquery for name validation but when I use test function it doesn't run. Here is the code</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $('#msg').hide();
  
          $('input[name = "frequency_add_button"]').click(function () {
              var error = validate_add_form();
              if (error !== '') {
                  $('#msg').show();
                  $("p:first").html(error);
                  return false;
              }
          });
  
          function validate_add_form() {
              var strname = $('#frequency_name_add').val();
              var illegal_chars = "/^.*?(?=[\^#%$\*:&lt;&gt;\?\{\|\}\@\!]).*$/";
  
              if ($.trim(strname) === '') {
                  return 'Please enter frequency name';
              }
              if ($.trim(strname).length &lt; 4 || $.trim(strname).length &gt; 10) {
                  return 'Frequency name length must be between 4 and 10 characters';
              }
              /*if(illegal_chars.test(strname))
              {
                  return 'Special characters are not allowed in frequency name';
              }*/
              return '';
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>For checking blank and length this works fine but when I uncomment the commented part nothing runs at all. It is right syntax to check for illegal characters in jquery? Thanks for help.</p>