title: Using functions or methods in Java's String.replaceAll() regex
body: <p>I am trying to convert an RPN-equation into a string that matches tigcc rules. There numbers must have the number of chars in front of them and a tag for positive or negative. For "2" it would be "1 2 POSINT_TAG"</p>
  
  <p>My complete input to rpn converter is based on regexes, so I wanted to use them again and have a <code>String.replaceAll()</code> function like:  </p>
  
  <pre><code>string.replaceAll("(\d+)","$1".length+" $1 POSINT_TAG");
  </code></pre>
  
  <p>But there it just prints: "2 number INT_TAG". I found some classes like com.stevesoft.pat (<a href="http://www.javaregex.com/" rel="noreferrer">link</a>).</p>
  
  <p>Is there another way implemented in normal Sun Java to use (custom) functions in replace rules of regexes?</p>