I want to do a case sensitive search for a particular piece of code in a GitHub repository. Is it possible?
I checked https://help.github.com/articles/searching-code/ and didn't find such a syntax rule.
I want to do a case sensitive search for a particular piece of code in a GitHub repository. Is it possible?
I checked https://help.github.com/articles/searching-code/ and didn't find such a syntax rule.
Use grep
or git grep
in your local clone. The GitHub search has a lot of limitations. I think the worst of these is that it only shows the first two matches from any file, so I just avoid it whenever possible.
Say you want results for my_var
but not MY_VAR
. Use this regex search:
/(?-i)my_var/
The -i
flag here is essentially the opposite of the same grep
option (grep is case-sensitive by default and -i
makes it case-insensitive).
This is a new option included in the rollout of GitHub's blog on new Code Search feature.
There is an indirect way. Hit .
(which will redirect you to github.dev) to open the repo in VSCode for the Browser.
There you can do a case-sensitive search.