Regular expression as a parameter in painless

NOTE: all the queries are saved in the percolator and we are doing a search in percolator

I use this script to support wildcard searches of all combination

aus * gov*
polic*
*alia *ment

Like these all combination

If I use Prefix query | Elasticsearch Guide [8.11] | Elastic does it help me to solve these requirements. I was using ngrams and edge-ngrams, but uses lot of spaces.

If I increase script.max_compilations_per_minute to 1000 or more, of-course it will impact the performance but at what level?