How to create a variable with regex on basis of a PART of another variable?

Hi,

I have following problem:
I have a variable, $appliance with example value PLONINNASS99
I want to create another variable, $array that has the value based on the first 4 letters of $appliance, so in this case (plon)+“inpurr”, and another variable $volume that has the regex of the letters 7-12 of $appliance. So any volume that has “NASS99” in the name.

For the array I would write:
query: show tag values with key = array where
regex: and here I don’t find how to write that array name should have first 4 letters of $appliance in it.

I did not find any examples of this anywhere Grafana.

Any advice on this?
thanks , regards
Janos