title: Replace getters with property with IntelliJ Structural Search and Replace
body: <p>Due to changes in a library I'm using, the getters were replaced with direct access to the property.  Eg:</p>
  
  <pre><code>public class MyLibraryClass {
    private String field;
  
    public String getField() { return field; }
  }
  </code></pre>
  
  <p>has become</p>
  
  <pre><code>public class MyLibraryClass {
    public String field;
  }
  </code></pre>
  
  <p>Consequently I'd want to use IntelliJ's SSR to replace the getter calls with the Bean property.  However I've gotten stuck on how to use regexp capture groups for my replacement.  If there's another IntelliJ shortcut to do what I want, I'm happy to use it.</p>
  
  <p>The following SSR search parameters find the getters, but I can't seem to be able to use the capture group for <code>$property$</code> in the replacement.  I've tried <code>\1</code> and <code>\$1</code> and <code>$1</code> see (<a href="https://stackoverflow.com/questions/1421797/regex-backreferences-in-intellij" title="using backreferences in IntelliJ">using backreferences in IntelliJ</a>)</p>
  
  <p>I also tried changing the search to <code>$instance$.get$property$()</code> (clearing the constraints for <code>$property$</code> but the search didn't return any results.</p>
  
  <ol>
  <li>How can I access the capture group (<code>$1</code>)</li>
  <li>Is it possible to perform any processing on <code>$1</code> before substitution (to fix the case)</li>
  </ol>
  
  <p>I noticed the <code>Script text</code> option which accepts Groovy code, however I couldn't find any documentation on this feature.</p>
  
  <p><img src="https://i.stack.imgur.com/HUKZW.png" alt="SSR search template">
  <img src="https://i.stack.imgur.com/TxVMK.png" alt="instance variable config">
  <img src="https://i.stack.imgur.com/eKh5l.png" alt="property variable config"></p>