search: check patterns for field prefix
Created by: rvantonder
Part of #13128. Fixes a minor issue where prior to this PR:
(repocommitafter:"thing with a space")
=> interpreted as a search pattern (repocommitafter:"thing with a space")
.
Desired meaning: interpret this as repocommitafter:"thing with a space"
.
First commit performs the change and adds the test. The second commit factors out the shared code we use for parsing and checking, and updates some tests.
Long version:
The previous behavior erroneously interpreted a pattern instead of the desired group containing parameters when the group syntax (...)
contained a parameter with a quoted value containing a space. This is because the search pattern parser heuristic would terminate at a space, and not realize that the quotes mean that it is a single value. Because its too tricky to try and also recognize well-quoted values for these in that function, I'm changing the heuristic to recognize valid fields by prefix earlier, rather than consider the values.