Live data from Hacker News

Show HN: Search code in GitHub repos using regular expressions

grep.app

161–165 of 165 posts

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

#161
Superb work. You built a better code search than Github (well with some of its features missing sure) with a lot less resources. Shows how stagnated the progress in big companies is after a service is deemed "good enough". Good for you kicking them in their butts to lead the way. Hope you get out of this something else too than HN karma.

Really like the minimalistic design, not too designy but still easy on my eyes. Just the way I want it to let me focus on the task at hand

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

#162
post #64

Earlier quoted context omitted.

Ripgrep is based on RE2 and supports backrefs. Wonder why they didn't use that.

Not quite. ripgrep uses Rust's regex engine, not RE2. Rust's regex engine is descended from RE2, but there is no code sharing. Rust's regex engine does not support backreferences. RE2 does not either. ripgrep does however have a -P/--pcre2 flag which causes it to use PCRE2 instead of Rust's regex engine. PCRE2 supports backreferences and other things, like look-around. (ripgrep also has an --auto-hybrid-regex flag, w…

Perhaps to protect against ReDoS the client should use an extended finite automata (1).

https://www.arl.wustl.edu/~pcrowley/a25-becchi.pdf

(1) Extending Finite Automata to Efficiently Match Perl-Compatible Regular Expressions.

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

#164

Earlier quoted context omitted.

Not quite. ripgrep uses Rust's regex engine, not RE2. Rust's regex engine is descended from RE2, but there is no code sharing. Rust's regex engine does not support backreferences. RE2 does not either. ripgrep does however have a -P/--pcre2 flag which causes it to use PCRE2 instead of Rust's regex engine. PCRE2 supports backreferences and other things, like look-around. (ripgrep also has an --auto-hybrid-regex flag, w…

Perhaps to protect against ReDoS the client should use an extended finite automata (1). https://www.arl.wustl.edu/~pcrowley/a25-becchi.pdf (1) Extending Finite Automata to Efficiently Match Perl-Compatible Regular Expressions.

Nope. That still supports backreferences, and resolving backreferences is an NP-complete problem.[1] And I don't see anything in that paper that addresses that. Note that there may be some versions of the problem that maybe aren't NP-complete[2], but again, not addressed by that paper.

Besides, that paper was published 12 years ago. Where is the productionized version of it? Or are you suggesting the the OP go spend a few years writing a regex eninge? :-) Doesn't seem like a particularly practical suggestion.

[1] - https://perl.plover.com/NPC/NPC-3SAT.html

[2] - https://branchfree.org/2019/04/04/question-is-matching-fixed...

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

#165

Earlier quoted context omitted.

Perhaps to protect against ReDoS the client should use an extended finite automata (1). https://www.arl.wustl.edu/~pcrowley/a25-becchi.pdf (1) Extending Finite Automata to Efficiently Match Perl-Compatible Regular Expressions.

Nope. That still supports backreferences, and resolving backreferences is an NP-complete problem.[1] And I don't see anything in that paper that addresses that. Note that there may be some versions of the problem that maybe aren't NP-complete[2], but again, not addressed by that paper. Besides, that paper was published 12 years ago. Where is the productionized version of it? Or are you suggesting the the OP go spend…

In the paper there are some bounds about the number of states in the automata as a function of the length of the input. So one could limit the length of the input when using back references to bound the complexity of the algorithm. They have used their algorithm for snort (network intrusion detection) using asic. The author could contact the authors of the paper and ask for (or pay for) an implementation.

By the way, good work ripgrep and rust.

Post reply on HN