precompiling query may write regex

Right now it's creating a new regex for each call to the method.