Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Limiting the benchmark to engines supporting matching sets of regexes seems unnecessarily narrow to me. Is matching a set of regexes not equivalent to matching a single combined regex? Something like "(?:a)|(?:b)|(?:c)"? If so, why not run the test with that regex instead, and include other engines?


For engines like Hyperscan and RE2's underlying algorithms, alternation works the way you describe. However, for backtracking engines, alternation does not do a search in parallel for all the patterns. Instead, it winds up first looking for the first, then the second, etc., finds the first match, and declares victory. There are particular patterns and inputs where this behavior will be similar to parallel matchers like RE2::Set and Hyperscan, but the general case just won't work.


The complication occurs when you need to identify which sub-expression matched.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: