@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 str = inputs[i].toString();
        Matcher matcher = pattern.matcher(str);
        if (matcher.find() && matcher.groupCount() >= group) {
          builder.writeBinary(new Binary(matcher.group(group).getBytes()));
        } else {
          builder.appendNull();
        }
      }
    }
  }
This function matches substring according to given regex from an input series.
library-udf/src/main/java/org/apache/iotdb/library/string/UDTFRegexMatch.java