Skip to content

Fix fixup queries

Administrator requested to merge fix-fixup-queries into master

Created by: ijsnow

This PR implements a type that fixes common mistakes in regular expressions in our search queries. This uses regexp/syntax under the hood so we actually operate on the regular expression itself. This also means that it's possible for the regular expression parser to change the regular expression into something that is equivalent but "better" in it's opinion. An example is expanding \s to [\t-\n\f-\r ] which is equivalent. There are some cases that it changes things that end up breaking the regexp package's compiler, such as ^ to \A, which is a perl syntax. For this reason, we created our or String function derived from regexp/syntax.Regexp.String which prevents changes we don't want from happening.

Closes https://github.com/sourcegraph/sourcegraph/issues/2125.

Merge request reports

Loading