Grafana Variable help + regex

I am trying to setup some variables in my dashboard that will take part of the metric name, and not a label. I want to do this as we are appending/inserting the server name into the metric name itself in order to cut down on the carnality of metrics.

So far I was able to I am using a Datasource Query with Cortex.

My Query to get the list of metrics is:

{__name__=~MYMETRIC_.*}

this would return results like:

MYMETRIC_BASIC_SERVER1_CPU_USAGE{instance="blah", job="foo"}

MYMETRIC_BASIC_SERVER2_CPU_USAGE{instance="blah", job="foo"}

MYMETRIC_BASIC_SERVER3_CPU_USAGE{instance="blah", job="foo"}

The variable and regex should only grab the Server part. So that it only returns the following:

SERVER1

SERVER2

SERVER3

I did try to use the regex101 builder site and came up with the following regex;

^(?:[^_]+_){2}([^_]+) but grafana throws an error.

I it possible to capture variables like this?