title: Delphi TRegEx backreference broken?
body: <p>I have a problem using <code>TRegEx.replace</code>:</p>
  
  <pre><code>var
    Value, Pattern, Replace: string;
  begin
    Value   := 'my_replace_string(4)=my_replace_string(5)';
    Pattern := 'my_replace_string\((\d+)\)';
    Replace := 'new_value(\1)';
    Value   := TRegEx.Replace(Value, Pattern, Replace);
    ShowMessage(Value);
  end;
  </code></pre>
  
  <p>The expected result would be <code>new_value(4)=new_value(5)</code>, while my code (compiled with Delphi XE4) gives <code>new_value(4)=new_value()1)</code></p>
  
  <p>With Notepad++, I get the expected result.</p>
  
  <p>Using a named group makes it clear the <code>1</code> is the backreference treated literally:</p>
  
  <pre><code>Pattern := 'my_replace_string\((?&lt;name&gt;\d+)\)';
  Replace := 'new_value(${name})';
  // Result: 'new_value(4)=new_value(){name})'
  </code></pre>
  
  <p>The replacement is always that simple (could be zero or more times <code>my_replace_string</code>), so I could easily create a custom search-and-replace function, but I'd like to know what goes on here.</p>
  
  <p>Is it my fault or is it a bug?</p>