Make sure the query string has valid regex and add a test