githubgithub-apisourcegraphgithub-search

Search github repo for term with special characters using sourcegraph?


The top answer to How to search on GitHub to get exact string matches, including special characters shows a way to search GitHub for terms that include special characters using a tool called sourcegraph.

I got that working:

https://sourcegraph.com/search?q=context:global+.where%28&patternType=literal

but I'd like to narrow the search to a specific repo (not all of GitHub) - how can I do that?

Example

Here's the exact search I tried on GitHub:

https://github.com/sharetribe/sharetribe/search?q=.where%28

(it searches for where instead of .where(.

Here's the search on sourcegraph:

https://sourcegraph.com/search?q=context:global+.where%28&patternType=literal

It returns results for all of GitHub rather than the specific repo sharetribe/sharetribe.

How can I limit this search to one repo?


Solution

  • You can limit this search by using the repo filter:

    https://sourcegraph.com/search?q=context:global+repo:sharetribe/sharetribe+.where%28&patternType=literal

    enter image description here