Facing issue with parsing lucene query in grafana template variable. Please assist

Version - 9.5.3

I’m trying to use template variable to get the string with dynamic values (Test-1234567 or some 7 digit number). Looking to retrieve the records starting from “PreupdateTest=234567 is valid”

Tried below in template variable
{“find”: “terms”, “field”: “exception._exceptionerrormsg.keyword” , “query”: “PreupdateServiceImpl::preupdate30003: Field eip_tracking.host_id lookup value Test=[0-9]{6} is invalid” }

how can I achieve this? Please help?