Backreferencing/RegEx in Kapacitor .tick scripts for Continuous Queries

kapacitor
influxdb

#1

I am just working on transferring some CQs from InfluxDB to Kapacitor.

The original working CQ is this:

CREATE CONTINUOUS QUERY "ds.1h"
	ON ninatest
	RESAMPLE EVERY 1h FOR 1h
		BEGIN SELECT sum(*)
		INTO ninatest.autogen.:MEASUREMENT
		FROM ninatest2.autogen./.*/
		GROUP BY time(1h), *
END

The tick is this (for test reasons a batch for now and period set to 1min):

dbrp "ninatest2"."autogen"

batch
    |query('SELECT sum(*) FROM "ninatest2"."autogen"./.*/')
        .period(1m)
        .every(1m)
        .groupBy(*)
    |influxDBOut()
        .database('ninatest')
        .retentionPolicy('autogen')
        .measurement(:MEASUREMENT)
        .precision('s')

Issue:
When I enable the task for this tick script it get the following reply:
invalid TICKscript: parser: unexpected unknown state, last char: ‘:’ line 11 char 22 in “asurement(:MEASUREME”. expected: “number”,“string”,“duration”,“identifier”,“TRUE”,“FALSE”,"==","(","-","!"

I also tried
.measurement(/.*/) with the error:
invalid TICKscript: line 11 char 10: error calling func "measurement" on obj *pipeline.InfluxDBOutNode: reflect.Set: value of type *regexp.Regexp is not assignable to type string

.measurement(/.*/) with the error:
invalid TICKscript: parser: unexpected . line 11 char 22 in "asurement(.*)". expected: "number","string","duration","identifier","TRUE","FALSE","==","(","-","!"

I understand, that there are errors, since a string is expected.
How can I use backreference for the measurement name? I have quite a couple of measurements which change dynamically and cannot write a rule for every single one.


#2

I found a solution by trying more things out. It is to leave the string empty like this .measurement('')

Either I just couldn’t find it in the docs, although it feels like I read every page of it, or it’s not there. In both cases it would be great to make the information on how to make .tick scripts more dynamical more accessible.