Live data from Hacker News

Show HN: Search code in GitHub repos using regular expressions

grep.app

21–30 of 165 posts

Re: Show HN: Search code in GitHub repos using regular expressions

#21

Why regex still exists? It is unintuitive, requires mastering an obscure syntax, it is very hard to debug, and very difficult to explain to others how it works. It feels like we are trying to write intermediate code by ourselves, while we should have a human readable language that generates regex.

The investment into learning regexes is worth it if you write or read enough of them. They become the human readable language you speak of, eventually. The question is where the threshold lies.

Re: Show HN: Search code in GitHub repos using regular expressions

#22
post #6

Amazin, why Microsoft hasn't built this for GitHub yet is beyond me. Can it grep on individual repos?

Why would you want to use this tool to grep individual repos? If you know the repo you're interested in, you can just clone it and then grep it locally...?

Re: Show HN: Search code in GitHub repos using regular expressions

#23
This is really cool. What are you using it for? Usage examples, debugging, etc.?

I'm the CEO at Sourcegraph (universal code search for companies to use on their internal code). Our product is really optimized for searching a company's internal code right now, but soon we'll start working on offering much better search for public and open-source code as well. If you'd like to help out or just chat, please reach out! sqs@sourcegraph.com

Re: Show HN: Search code in GitHub repos using regular expressions

#25

Earlier quoted context omitted.

I looked for strings that I am sure only appear in my code, and I found several copies of them, but not mine.

Can you provide detailed steps to reproduce? What strings did you search? Two examples of repos that appeared in the results? What is the link to your repo that did not appear in the results? Details like this would help the OP to track down the exact cause of why it has indexed the forks but not the original repo.

The authors are quite explicit that this site only includes a fraction of all github repos. Thus, this is not a "bug" that needs to be corrected.

In my case, I am not talking about forks but about people who copied my files into their repositories (with proper attribution and respecting the license). I just searched for my surname and was happily surprised to see it in major projects like ffmpeg, pytorch, bytedeco, scikit and opencv.

Re: Show HN: Search code in GitHub repos using regular expressions

#26
GitHub confirmed to me that their search is not able to find in substrings; this is annoying because if you want to find all affected code among all possibly involved repositories, before a change, you need to clone them and grep locally. In the end this means you need to clone absolutely everything you work with, because otherwise you might miss changing that one repo you didn't think of:

https://stackoverflow.com/questions/43891605/search-partial-...

I've used Sourcegraph and it was cool; will have a look at this new tool too. But, GitHub pretty please add plain food old grep abilities to your search!

Re: Show HN: Search code in GitHub repos using regular expressions

#27
A tangent, my biggest gripe with GitHub code search (within a repo) off the top of my head is the inability to blacklist directories or only search whitelisted directories. Often times I want to look up the implementation of a function, and bam, three pages of results from tests.

Re: Show HN: Search code in GitHub repos using regular expressions

#28

This is awesome! @danfox, sent you an email though commenting here too. I'm the CTO @ GitHub. Would love to talk to you about this and other things we are building in this area at GitHub. Feel free to email direct to jason at github.com

hah. you beat me to it, Jason.

@danfox, i'm always down to talk code search as well - rand@github.com

Re: Show HN: Search code in GitHub repos using regular expressions

#29
post #6

Amazin, why Microsoft hasn't built this for GitHub yet is beyond me. Can it grep on individual repos?

Why would you want to use this tool to grep individual repos? If you know the repo you're interested in, you can just clone it and then grep it locally...?

So you don’t have to clone it and grep it locally
Post reply on HN