Insights/replace captured values in query
Created by: coury-clark
Part of https://github.com/sourcegraph/sourcegraph/issues/40045
Adds support to "reverse engineer" a regexp from it's matches to regenerate new regexp strings that match more specific values. In this case only the first capturing group is eligible for replacement.
For example given a regexp \w{3}(.{3})\w{3}
and the text foobardog
generate \w{3}(?:bar)\w{3}
This will be used for drilldown when viewing Code Insights that are dynamically generated from a capture group.
A future PR is coming that will more clearly define the interface of how the aggregator client will use this.
Test plan
Tests included and will be tested more once integrated with Sourcegraph queries