(PDB-950) Added validation for regexps in queries

This commit adds a validation for regexps in queries as was proposed in PDB-950
How about this, why not go ahead and add the re-pattern style validation for everything, but also try and catch the exception for PG like you see in PDB-950 at the same time. At least if someone tries to use something that is too complex for PG we have a fallback. It seems like a reasonable approach for now, but I think both steps are desirable for PG and to solve PDB-950. We'll meditate separately on whether this is a good idea for PG ... what I'm generally wary of is removing features people might be using ultimately. In the worst case we could apply the up front validation only for HSQLDB perhaps, that should just be an extra (when ...) statement somewhere, so shouldn't be a massive change later on.