4 ms·
I wonder why they didn't just include an option to use a non-backtracking algorithm, like re2's[1]. As far as I know, that would completely eliminate the possi
by ainar-g 5y ago
I wonder why they didn't just include an option to use a non-backtracking algorithm, like re2's[1]. As far as I know, that would completely eliminate the possibility of catastrophic backtracking happening.
[1]: https://github.com/google/re2 https://github.com/google/re2
- byroot 5y agoIt was explored but decided against, at least for now https://bugs.ruby-lang.org/issues/18653 https://bugs.ruby-lang.org/issues/18653
- dragonwriter 5y agoWrapping RE2 with a fallback to the existing engine to try to maintain compatibility was explored; that, like the timeout approach, is pretty clearly a stopgap measure; actually implementing an RE2-style algorithm without the compatibility and toolchain warts of RE2 for Ruby's existing code and functionality is a bigger but more permanent solution, that I don't think has really been ruled out of explored.
- riffraff 5y agoif you break compatibility you might as well just use some re2 bindings[0] [0] https://github.com/mudge/re2 https://github.com/mudge/re2