title: help using Java Matcher to modify a group
body: <p>I want to match on a regex and modify the match. here is my function. right now, my method doesn't change the input at all. what is wrong? thanks.</p>
  
  <pre><code>    Matcher abbrev_matcher = abbrev_p.matcher(buffer);
      StringBuffer result = new StringBuffer();//must use stringbuffer here!
      while (abbrev_matcher.find()){
          //System.out.println("match found");
          abbrev_matcher.appendReplacement(result, getReplacement(abbrev_matcher));
      }
      abbrev_matcher.appendTail(result);
  
  private static String getReplacement(Matcher aMatcher){
      StringBuilder temp = new StringBuilder(aMatcher.group(0));
      for (int i = 0; i &lt; temp.length(); i++){
        if (temp.charAt(i) == '.'){
            temp.deleteCharAt(i);
        }
  
      }
      return temp.toString();
  }
  </code></pre>