search: interpret // specifically as a literal pattern for regexp search
Created by: rvantonder
Our regexp search syntax includes delimited slashes, like /<thing>/
to search for a regexp <thing>
. This is true even when <thing>
is empty. So, we will convert //
to "" (empty string) when the pattern is a regexp.
There's very little utility of searching for "". It is far more likely that a user would intend to search for //
comments when the value is empty. So I support the behavior for //
to be interpreted literally in regexp mode. The main thing instigating this change is the previous unexpected behavior when //
means empty string, and seeing unintuitive results, esp for code insights matching //
-style comments: https://github.com/sourcegraph/sourcegraph/issues/31195#issuecomment-1043352730
Test plan
Adds unit tests for new behavior.