title: emacs query-replace-regexp inverted
body: <p>Is there an existing package that targets subexps for replacement during
  <code>query-replace-regexp</code>?</p>
  
  <p>For example given the following</p>
  
  <pre><code>var foo1 = blah( properties, property_id);
  
  var foo2 = blah(properties, property_id );
  
  var foo3 = blah(  properties, property_id      );
  </code></pre>
  
  <p>I want to remove the padding around braces.</p>
  
  <p>Normally, the way is to subgroup the bits you want to keep and assemble a replacement.</p>
  
  <p>search:</p>
  
  <pre><code>\(var .* = blah\s-*(\)\s-*\(.*?\)\s-*\()\)
  </code></pre>
  
  <p>replace:</p>
  
  <pre><code>\1\2\3
  </code></pre>
  
  <p>However, it seems much easier to some up with a regexp that groups the bits I
  want to delete than the otherway around.  Like this one:</p>
  
  <pre><code>var .* = blah\s-*(\(\s-*\).*?\(\s-*\))
  </code></pre>
  
  <p>I'll get two subgroups out of this.  How can I target them for replacement?</p>
  
  <p>EDIT: I'm asking for an interactive way to "invert" the given regexp.  So the interface would be similar to <code>query-replace-regexp</code></p>
  
  <ol>
  <li>enter regexp</li>
  <li>enter replacement for group 1</li>
  <li>enter replacement for group 2</li>
  </ol>