title: Regular expressions in C# for file name validation
body: <p>What is a good regular expression that can validate a text string to make sure it is a valid Windows filename? (AKA not have <code>\/:*?"&lt;&gt;|</code> characters).</p>
  
  <p>I'd like to use it like the following:</p>
  
  <pre><code>// Return true if string is invalid.
  if (Regex.IsMatch(szFileName, "&lt;your regex string&gt;"))
  {
      // Tell user to reformat their filename.
  }
  </code></pre>