safe-regex2 reliably determines if a regular expression is safe from catastrophic backtracking. This crucial security tool safeguards against ReDoS (Regular expression Denial of Service) attacks by analyzing regex patterns. It returns true if safe and false otherwise. Use it to prevent malicious or unintentionally complex regexes from crippling your Node.js applications. Mitigate potential performance bottlenecks and security vulnerabilities with this improved version of the original safe-regex library.
The npm package safe-regex2 has seen infrequent releases. Version 2.0.0 was released in February 2019. After more than three years version 3.0.0 was released in May 2022, followed by 3.1.0 in December 2022. Releases continued sporadically in July/December 2024. The latest release of the package, version 5.0.0, was in March 2025, and no releases have occurred since then.
Safe-regex2 downloads show consistent growth. From March 2024 to August 2025, downloads increased from ~7 million to over 12 million. There's a clear upward trend, with the highest recorded downloads in July 2025. August 2025 data is incomplete so this month could be above previous months.