How to manipulate variable string for a certain query?

Hello!

I hope someone can help me or can give me a hint:

  • What Grafana version and what operating system are you using?
    8.5.2

  • What are you trying to achieve?
    I have defined a custom variable with inputs like ABC001 (always 3 letter and 3 digits). In my dashboard i would like to make a query on an InfluxDB that is filtering on that variable but only on the first 3 letters.

  • How are you trying to achieve it?
    I have tried a lot of queries like, but it doesn’t work:
    SELECT last(“value”) FROM “device” WHERE (“TE” =~ /\D+$Variable/)
    SELECT last(“value”) FROM “device” WHERE ( “TE” =~ /$Variable[^0-9]/)

Thanks!