use the same regex for lucene escapes, close #143

The escapes for the value were updated recently but the escapes for the
query were forgotten.
Now we use a variable for the regex to reduce duplication.
Not sure why or where performance/efficiency comes in place all of a sudden. That regex is not really a bottleneck here or something where we can actually gain performance.
We are using a regex for replacement in a 1-line string, then sending data over the net and then receiving an even bigger amount of data and parsing xml.
See also the note about compiling regexes in the [python docs](https://docs.python.org/2/library/re.html#module-contents). Short: compiling regexes is absolutely unnecessary unless you are tackling a specific bottleneck. It does not make the code more readable.

About the module level constant. I don't care much either way. Having it at the top is nice, because having constants at the top is nice in general. Having it in the function is nice, because this way you can see "the whole" thing (algo, constant) with "one look".

@alastair: Better push your patch to some branch and leave a note. I certainly wouldn't have made one myself then ;-)