Create Azure Monitor query variable from another one

We’re using Grafana Cloud 8.0.2 and we have setup an Azure Monitor Query variable like so:

Is it possible to create another variable which references this one but uses regular expressions to only get the part after the last backslash of the database names ?
I know that if we apply the /([^/]+$)/ regular expression on the result of ResourceNames(rg-, Microsoft.Sql/servers/databases) we get only the part we want.

Basically we wanted to have this other variable:

But this returns the Query could not be parsed at ‘sql’ on line [1,0]

Can this be done?

I figured out how to accomplish this.
Instead of trying to create the second variable with the Azure Monitor data source, I’ve used the SQL Server data source, and used this query instead:
SELECT SUBSTRING(’$databaseResourceName’, CHARINDEX(’/’, ‘$databaseResourceName’) + 1, LEN(’$databaseResourceName’) - CHARINDEX(’/’, ‘$databaseResourceName’))

With this query, there was no need for regular expressions.
I suspect that the query I was trying to achieve would not be possible using the Azure Monitor data source