code: public static Filter replaceInBuffer(final Pattern regexp, final String replacement) {
          return new FilterAdapter() {
              @Override
              protected boolean doAfterAppend(StringBuilder buffer) {
                  Matcher matcher = regexp.matcher(buffer);
                  String str = matcher.replaceAll(replacement);
                  buffer.replace(0, buffer.length(), str);
                  return false;
              }
          };
      }
docs: Creates a filter which replaces every substring in the input buffer that matches the given
  regular expression
  and replaces it with given replacement.
  <p/>
  The method just calls {@link String#replaceAll(String, String)} for the entire buffer
  contents every time new
  data arrives,
  
  @param regexp      the regular expression
  @param replacement the string to be substituted for each match
  @return the filter