code: public String replaceAll(String replacement) {
          reset();
          StringBuffer buffer = new StringBuffer(input.length());
          while (find()) {
              appendReplacement(buffer, replacement);
          }
          return appendTail(buffer).toString();
      }
docs: Replaces every subsequence of the input sequence that matches the
  pattern with the given replacement string.
  
  <p> This method first resets this matcher.  It then scans the input
  sequence looking for matches of the pattern.  Characters that are not
  part of any match are appended directly to the result string; each match
  is replaced in the result by the replacement string.  The replacement
  string may contain references to captured subsequences as in the {@link
  #appendReplacement appendReplacement} method.
  
  <p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
  the replacement string may cause the results to be different than if it
  were being treated as a literal replacement string. Dollar signs may be
  treated as references to captured subsequences as described above, and
  backslashes are used to escape literal characters in the replacement
  string.
  
  <p> Given the regular expression <tt>a*b</tt>, the input
  <tt>"aabfooaabfooabfoob"</tt>, and the replacement string
  <tt>"-"</tt>, an invocation of this method on a matcher for that
  expression would yield the string <tt>"-foo-foo-foo-"</tt>.
  
  <p> Invoking this method changes this matcher's state.  If the matcher
  is to be used in further matching operations then it should first be
  reset.  </p>
  
  @param  replacement
  The replacement string
  
  @return  The string constructed by replacing each matching subsequence
  by the replacement string, substituting captured subsequences
  as needed