Use multiple variables in FROM query

I would like to use the InfluxDB query syntax SELECT * FROM <database_name>…<measurement_name> when setting up a query. This works if I literally type in the database name and measurement name, such as SELECT * FROM test_database…temperature. However, I want both the database name and the measurement name to come from variables I have created called dabase1 and var1. I have tried SELECT * FROM /^$database1$/…/^$var1$/ , SELECT * FROM /^[[database1]]$/…/^[[var1]]$/ and many other combination. What is the proper way to do this?