title: fnr.exe regex capture groups output
body: <p>I'm using a batch script with fnr.exe to perform bulk search and replace operations over multiple files, but I'm having trouble figuring out how to use capture groups in fnr.exe.  I can use them fine in a similar utility called FAR that uses java regex's, but FAR can't be run from the command line, so I'm unable to automate it.  Fnr.exe says in it's documentation that it uses .NET regular expressions, and the documentation for .NET regular expressions is great when it comes to how to capture a group, but when it comes to outputting the captured group, it's rather lacking and assumes I'm writing C# or VB code where I can call things like:</p>
  
  <pre><code>Console.WriteLine("Match: {0}", match.Value)
  </code></pre>
  
  <p>I have a bunch of strings like the following, with the original string on the left and my desired replacement string on the right:</p>
  
  <pre><code>include "fooPrintDriver.h";    |    include "barPrintDriver.h";
  include "fooSearchAgent.h";    |    include "barSearchAgent.h";
  include "fooEventListener.h";    |    include "barEventListener.h";
  </code></pre>
  
  <p>In FAR, I could find the strings on the left with </p>
  
  <pre><code>foo(.*?)\.h"
  </code></pre>
  
  <p>And then replace it with my desired string using</p>
  
  <pre><code>bar\1.h"
  </code></pre>
  
  <p>Where the '\1' would be PrintDriver or SearchAgent or EventListener, however when I try the same thing in fnr.exe, the '\1' is literally '\1', so my input and output will be:</p>
  
  <pre><code>include "fooPrintDriver.h";    |    include "bar\1.h";
  include "fooSearchAgent.h";    |    include "bar\1.h";
  include "fooEventListener.h";    |    include "bar\1.h";
  </code></pre>
  
  <p>Anyone know how to get it working in fnr.exe?</p>