News for hackers. Stuff that matters.
Re:Show HN: Search code in GitHub repos using regular expres... by jasoncwarner on Sunday February 23, 2020 @11:34AM (#22397728)
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

Re:Show HN: Search code in GitHub repos using regular expres... by sovietmudkipz on Monday February 24, 2020 @06:43AM (#22403257)
I do enjoy moments like these on hacker news when someone presents a project for X and the CTO of X shows up and wants to talk. It shows how directly of an impact one can potentially have in this community.

I hope this means we’re getting grep searches for github soon. Cheers.

Re:Show HN: Search code in GitHub repos using regular expres... by travbrack on Monday February 24, 2020 @12:17PM (#22406017)
If OP's goal was to get a job at Github, I'd say this was very well played.
Re:Show HN: Search code in GitHub repos using regular expres... by sdesol on Monday February 24, 2020 @12:34PM (#22406170)
It would certainly be an expensive play. When he mentioned a 20 core system, I'm assuming it is some VM system, since I don't know of any 20 core CPUs. I'm guessing he is using DigitalOcean and he has two of them, so he is looking at $1000 a month in hosting cost.
Re:Show HN: Search code in GitHub repos using regular expres... by samcrawford on Monday February 24, 2020 @01:52PM (#22407098)
It's an expensive side project for sure, but it doesn't have to be anywhere near as expensive as that.

My own side project uses a server with 20 cores (2x E5-2690v2 CPUs), with 256GB RAM and a 2TB SSD. This is a dedicated server I rented from tier.net in Texas, after seeing it listed on webhostingtalk [1]. It costs about $160/mo, and that's recently fallen further by paying for 3 months up front.

1. https://www.webhostingtalk.com/forumdisplay.php?f=36

Re:Show HN: Search code in GitHub repos using regular expres... by latenightcoding on Sunday February 23, 2020 @03:32PM (#22399342)
github's code search is notoriously bad, feels like a huge missed opportunity. Nice to see you guys reaching out to other people working in this area.
Re:Show HN: Search code in GitHub repos using regular expres... by sophiebits on Sunday February 23, 2020 @06:28PM (#22400319)
Re:Show HN: Search code in GitHub repos using regular expres... by lucasverra on Sunday February 23, 2020 @03:49PM (#22399420)
I'm not a dev and what i like to to do is go searching for code (a la exact match) to replace whatever variable or text should be changed. Github search in repo kinda worked at some moment, then not.

Then i had to download repo in my local; run VS code (updating first), search there, modify, push. I wish i could do this on Ghub web GUI

Re:Show HN: Search code in GitHub repos using regular expres... by erikpukinskis on Sunday February 23, 2020 @03:53PM (#22399444)
The fact that you can’t search for file names is the funniest part to me.
Re:Show HN: Search code in GitHub repos using regular expres... by WhiteOwlLion on Monday February 24, 2020 @12:54PM (#22406419)
If you fork a repo, you can't search on the forked repo. Confirmed grep.app behaves the same way as github search.
Re:Show HN: Search code in GitHub repos using regular expres... by nickthemagicman on Sunday February 23, 2020 @04:35PM (#22399706)
You can but only in the repo itself not on a site wide scale.
Re:Show HN: Search code in GitHub repos using regular expres... by cole-h on Sunday February 23, 2020 @09:16PM (#22401095)
Really? I searched for `filename:home.nix` (which brought me to https://github.com/search?utf8=%E2%9C%93&q=filename%3Ahome.n...). That seems site-wide to me, unless I'm misunderstanding you.
Re:Show HN: Search code in GitHub repos using regular expres... by giancarlostoro on Monday February 24, 2020 @09:33AM (#22404218)
These kind of keywords really should be next to the search box with a question mark next to them or something.

TIL some of them are on this page that you only see if you search for an empty string:

https://github.com/search?q=

Click on 'prefixes'. This kind of thing should be readily available from any search box that searches through GitHub.

Re:Show HN: Search code in GitHub repos using regular expres... by nickthemagicman on Sunday February 23, 2020 @09:43PM (#22401210)
That's awesome. I didn't know about the keyword filename: I've been using the button to the left of "Clone or Download" this whole time. Thanks for the info!
Re:Show HN: Search code in GitHub repos using regular expres... by aantix on Monday February 24, 2020 @10:05AM (#22404568)
Agree. You can’t even do a literal search with symbols.

I think there were better solutions on the early 2000’s.

Re:Show HN: Search code in GitHub repos using regular expres... by sixwing on Sunday February 23, 2020 @01:24PM (#22398523)
hah. you beat me to it, Jason.

@danfox, i'm always down to talk code search as well - [email protected]

Re:Show HN: Search code in GitHub repos using regular expres... by glangdale on Monday February 24, 2020 @06:33AM (#22403210)
iirc, Github uses (used?) my old project (https://github.com/intel/hyperscan) at Intel. It's probably faster than the alternatives, although if you want to support all types of regex you'll need to use Hyperscan as a prefilter for a richer regex engine like PCRE.

This project looks like it pulls literal factors out of the regex that I type in, maybe to an index a la that Russ Cox blog post a while back about Code Search. It seems to Not Like things that have very open-ended character classes (e.g. \w) unless there is a decent length literal involved somewhere.

It seems to have a very rudimentary literal extraction routine, as it decides to give a partial result set when fed an alternation between two literals that it handles pretty well on their own.

Re:Show HN: Search code in GitHub repos using regular expres... by glangdale on Monday February 24, 2020 @06:36AM (#22403228)
pattern is, btw: (teakettle\w|abcd)

Either pattern in alternation works fine, but even a simple alternation of the two goes back to the behavior that you might expect to get from awful patterns like \d..\d..\w...\s...\d (i.e. reporting only a partial set of matches).

Re:Show HN: Search code in GitHub repos using regular expres... by michaelmior on Monday February 24, 2020 @08:12AM (#22403687)
Did you mean either patter in "isolation"?
Re:Show HN: Search code in GitHub repos using regular expres... by glangdale on Monday February 24, 2020 @03:31PM (#22408106)
Yup, you're right - I wound up saying the opposite of what I meant!
Re:Show HN: Search code in GitHub repos using regular expres... by WhiteOwlLion on Monday February 24, 2020 @12:52PM (#22406391)
How about the ability to search code on forks? GitLab allows it. At least have feature parity? Thanks.