Enable use of last match back reference and fix resultant query string if malformed