title: Regex Replace with forward slash
body: <p>Can someone please explain how to get this regex working?  I'm trying to take this string:</p>
  
  <pre><code>"Test0/1"
  </code></pre>
  
  <p>and turn it into:</p>
  
  <pre><code>"Test0\/1"
  </code></pre>
  
  <p>I'm using this, but it is not working:</p>
  
  <pre><code>var test = Regex.Replace("Test0/1", @"/", @"\/");
  </code></pre>
  
  <p>It keeps giving me </p>
  
  <pre><code>"Test0\\/1"
  </code></pre>
  
  <p>Then I want to take the results of the string and put it into a Regex statement like so:</p>
  
  <pre><code>var match  = new Regex(test).Match(myString);
  </code></pre>
  
  <p>So the string 'test' has to be a valid regex statement.</p>
  
  <p>Basically what I'm trying to do is take a list of interfaces off a device, create a regex statement out of them and then use that regex to compare results for other things in my code.  Because of the way interfaces are formatted "FastEthernet0/1" for example, it is causing my regex to fail because you have to escape all forward slashes.  I have to build this regex on the fly though because every device will have a different set of interfaces.</p>