title: Handling regex escape replacement text that contains the dollar character
body: <pre><code>string input = "Hello World!";
  string pattern = "(World|Universe)";
  string replacement = "$1";
  
  string result = Regex.Replace(input, pattern, replacement);
  </code></pre>
  
  <p>Having the following example, the result would be <code>"Hello World!"</code>, as the <code>$1</code> gets replaced with the first group <code>(World|Universe)</code>, however the result I want is <code>"Hello $1!"</code></p>
  
  <p>The <code>Regex.Escape</code> method is meant to be used to escape a Regex pattern, not the replacement, as it can escape other characters like slashes and other Regex pattern characters.  The obvious fix to my problem is to have my replacement equal to <code>"$$1"</code>, and will achieve <code>"Hello $1!"</code>, but I was wondering if the dollar sign is the only value I have to escape (assuming <code>replacement</code> is user generated, and I do not know it ahead of time), or is there a helper function that does this already.</p>
  
  <p>Does anyone know of a function to escape the replacement value that <code>Regex.Replace(string input, string pattern, string replacement)</code> uses?</p>