3 ms·
This is basically what ripgrep will do for you automatically. (ripgrep uses Rust's regex engine, which is a descendant of RE2.) But when you get up into hundred
by burntsushi 5y ago
This is basically what ripgrep will do for you automatically. (ripgrep uses Rust's regex engine, which is a descendant of RE2.) But when you get up into hundreds of thousands of regexes, the NFA (and the resulting DFA) get really big. And things generally don't scale that well. Here's a good example: http://web.archive.org/web/20210302010420/https://01.org/hyperscan/blogs/jpviiret/2017/regex-set-scanning-hyperscan-and-re2set http://web.archive.org/web/20210302010420/https://01.org/hyp...
The problem is that for a big enough NFA, you'll wind up spending most of your search doing powerset construction to build the DFA.
> One thing you'll have to watch out for is RE2's maximum DFA size
You can configure this in ripgrep with the --dfa-size-limit flag. (See also --regex-size-limit.)