Kapacitor retagging measurements using regex?

Hello,

I’m using InfluxDB as a Prometheus remote_storage_adapter provider,
which supports writes&reads, and using prometheus to scrape haproxy (I am aware of telegraf supporting Prometheus type scrapes, not using that atm)
Consider the following measurement:

Influx line protocol:
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver01 value=1
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver02 value=1

Prometheus:
hapoxy_server_up{backend=“be_http_myproject_myapp”,instance=“myserver01”} value=1
hapoxy_server_up{backend=“be_http_myproject_myapp”,instance=“myserver02”} value=1

I’d like to be able to add a tag to that datapoint by processing the ‘backend’ tag through regex, so that the end result would be:

Influx line protocol:
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver01,project=myproject,application=myapp value=1
hapoxy_server_up,backend=be_http_myproject_myapp,instance=myserver02,project=myproject,application=myapp value=1

Prometheus:
hapoxy_server_up{backend=“be_http_myproject_myapp”,instance=“myserver01”,project=“myproject”,application=“myapp”} value=1
hapoxy_server_up{backend=“be_http_myproject_myapp”,instance=“myserver02”,project=“myproject”,application=“myapp”} value=1

The regex would be like this: RegExr: Learn, Build, & Test RegEx (/“be_.http_(.)_(.*)”/)
And using capture group $1 and $2 I can identify the projectname and applicationname of the haproxy backend…

Any suggestions on how to implement this in TICKscript syntax (influxDBOut)?