code: public static String replaceAll(
              String pattern, CharSequence input, String replacement) {
          input = new InterruptibleCharSequence(input);
          Matcher m = getMatcher(pattern, input);
          String res = m.replaceAll(replacement);
          recycleMatcher(m);
          return res;
      }
docs: Utility method using a precompiled pattern instead of using the
  replaceAll method of the String class. This method will also be reusing
  Matcher objects.
  
  @see java.util.regex.Pattern
  @param pattern precompiled Pattern to match against
  @param input the character sequence to check
  @param replacement the String to substitute every match with
  @return the String with all the matches substituted