How to search a GitHub repo using regular expressions or case-sensitive matching

Today I learnt …

Here’s a little hack I’ve discovered. You’ll need to be logged in to GitHub for this to work, but it’s possible search a repo using case-sensitive string matching — or even a regular expression — from GitHub’s website.

Here’s a hypothetical (and slightly contrived) example: let’s say you’re browsing through a repo online at There’s a class called Bar, and somewhere in the repo an array of Bar is instantiated. You can’t remember if that array is called bar or bars. The Bar class is used throughout the code so there are a lot of results if you simply search for ‘bar’. You need case-sensitive regex search, but GitHub’s search doesn’t support that.

What you can do, though, is press . (aka full-stop or period) while is open in your browser. If you’re logged in this will actually open — that is, not — and set up Visual Studio Code in your browser. Once that’s ready you can open up VS Code’s search sidebar, turn on case-sensitive matching and regexes, and type bars? into the search box. And voilà, only code that matches bar or bars (in lowercase) will appear in the results.