title: How do I create a regular expression to disallow backslash
body: <p>I am having trouble creating a regular expression to disallow the following four characters and limit the size:</p>
  
  <p>/
  #
  ?
  \</p>
  
  <p>What I currently have is:</p>
  
  <pre><code>Regex regex = new Regex("^[^/\\#?]{0,1024}$", RegexOptions.Compiled);
  if (!regex.IsMatch("\\"))
  {
      Console.WriteLine("Bad");
  }
  </code></pre>
  
  <p>All of the characters except \ are disallowed. I cannot get \ to work.</p>
  
  <p>Any suggestions on how to support this?</p>