@Override
  public void transform(Column[] columns, ColumnBuilder builder) throws Exception {
    Binary[] inputs = columns[0].getBinaries();
    boolean[] isNulls = columns[0].isNull();

    int count = columns[0].getPositionCount();
    for (int i = 0; i < count; i++) {
      if (isNulls[i]) {
        builder.appendNull();
      } else {
        String origin = inputs[i].toString();
        Matcher matcher = pattern.matcher(origin);
        builder.writeBinary(new Binary(getResult(origin, matcher).getBytes()));
      }
    }
  }
This function replaces substring according to regex parameter from an input series.
library-udf/src/main/java/org/apache/iotdb/library/string/UDTFRegexReplace.java