title: check a textbox for invalid characters using js and regular expressions
body: <p>I am having a hard time figuring out how RegExp work.</p>
  
  <p>I need to rewrite some ASP code into html and js, and I've hit an obstacle in this part:</p>
  
  <pre><code>&lt;asp:RegularExpressionValidator runat="server" id="RegExpValidator" controltovalidate="FileName" Display="Dynamic" ValidationExpression="[^#%&amp;*:&lt;&gt;?/{|}]+"&gt;
  </code></pre>
  
  <p>Now, what I do is create an input textbox which will run a js function whenever its content is changing.</p>
  
  <pre><code>&lt;input type="text" id="fileNameTextBox" class="ms-input" size="35" maxlength="123" onchange="regexValidator(this);"/&gt;
  
  function regexValidator(control) {
              var val = $(control).val();
              if(val == undefined || val == '') {
  
                  $(control).attr("class", "invalid");
              } 
              else { 
              // Regex stuff goes in here
              }
          }
  </code></pre>
  
  <p>Now, for the life of me I can't figure out how to construct the regular expression. The ValidationExpression field i assume checks for invalid characters though it doesn't seem to be a properly constructed regex, and I can't figure out how to write it into a proper one to use with js. Could someone help me out with this?</p>