Node.js bindings for Google's RE2 regex engine, providing a fast and safe alternative to backtracking regex engines.
node-re2 is a Node.js binding for Google's RE2 regular expression engine, providing a safe and performant alternative to JavaScript's built-in RegExp. It protects against Regular Expression Denial of Service (ReDoS) attacks by using deterministic finite automata instead of backtracking evaluation.
Node.js developers processing untrusted user input, building security-sensitive applications, or working with performance-critical regex operations on large datasets.
Developers choose node-re2 for its guaranteed linear-time matching that prevents ReDoS vulnerabilities while maintaining high compatibility with the standard RegExp API, plus additional features like Buffer support and multi-pattern matching.
node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses RE2's deterministic finite automata to guarantee linear-time matching, preventing exponential-time attacks from vulnerable regex patterns as highlighted in the README's security focus.
Direct support for Node.js Buffers enables efficient UTF-8 processing of binary data without string conversion, reducing overhead for long files or binary streams.
RE2.Set allows matching against multiple patterns with a single automaton, often outperforming sequential regex tests, as demonstrated in bundled benchmarks.
Always operates in Unicode mode with built-in UTF-8/UTF-16 conversion utilities, ensuring consistent character handling and avoiding encoding pitfalls.
Lacks support for backreferences and lookahead assertions, which are part of JavaScript's RegExp, forcing developers to rewrite patterns or fall back to RegExp with try-catch blocks.
In edge cases, RE2 may produce different results than built-in RegExp, requiring careful testing and verification when switching, as the README warns with examples.
As a C++ addon, it requires compilation or precompiled binaries, which can lead to installation issues on some platforms, especially without proper build tools.