search: add heuristic pattern scanner
Created by: rvantonder
We need a custom scanner that tolerates escape sequences for parentheses and whitespace, which are syntax in our language. This PR is a follow up to the limitation mentioned in https://github.com/sourcegraph/sourcegraph/pull/9620#discussion_r404536378.
The scanner code is similar to #9727, please see description/rationale for it there.