title: Replace named group in regex with value
body: <p>I want to use regular expression same way as string.Format. I will explain</p>
  
  <p>I have:</p>
  
  <pre><code>string pattern = "^(?&lt;PREFIX&gt;abc_)(?&lt;ID&gt;[0-9])+(?&lt;POSTFIX&gt;_def)$";
  string input = "abc_123_def";
  Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
  string replacement = "456";
  Console.WriteLine(regex.Replace(input, string.Format("${{PREFIX}}{0}${{POSTFIX}}", replacement)));
  </code></pre>
  
  <p>This works, but i must provide "input" to regex.Replace. I do not want that. I want to use pattern for matching but also for creating strings same way as with string format, replacing named group "ID" with value. Is that possible?</p>
  
  <p>I'm looking for something like:</p>
  
  <pre><code>string pattern = "^(?&lt;PREFIX&gt;abc_)(?&lt;ID&gt;[0-9])+(?&lt;POSTFIX&gt;_def)$";
  string result = ReplaceWithFormat(pattern, "ID", 999);
  </code></pre>
  
  <p>Result will contain "abc_999_def". How to accomplish this?</p>