code: public String replace(CharSequence text, ObsoleteReplacer replacer) throws IOException
      {
          if (text.length() == 0)
          {
              return "";
          }
          CharArrayWriter caw = new CharArrayWriter();
          InputReader reader = Input.getInstance(text);
          replace(reader, caw, replacer);
          return caw.toString();
      }
docs: Replaces regular expression matches in text using replacer
  @param text
  @param replacer
  @return
  @throws IOException