title: Regex to replace all special characters except slashes?
body: <p>I'm trying to work out some regex that will eliminate all of the special characters that SharePoint won't take when creating a folder.</p>
  
  <p>These are the characters that are not allowed and I am assuming that the bottom regex below will handle all of these. But I want to replace an \ or / with a dash as well.</p>
  
  <pre class="lang-none prettyprint-override"><code>~ " # % &amp; * : &lt; &gt; ? / \ { | }
  </code></pre>
  
  <p>So this is what I have so far, but I'm hoping to combine this all into one function, if possible.</p>
  
  <pre><code> private void RemoveAndReplaceSpecialCharacters(string input)
      {
          Regex.Replace(input, @"\\", @"-");
          Regex.Replace(input, @"/", @"-");
          Regex.Replace(input, @"[^0-9a-zA-Z\._]", string.Empty);
      }
  </code></pre>