I've recently released two new open source regex libraries.
regex
is a template tag for dynamically creating readable, high performance, native JavaScript regular expressions with best practices built-in and advanced features. It's lightweight, has no dependencies, and supports all ES2024+ regex features.
Highlights include using whitespace and comments in regexes, atomic groups via (?>…)
which can help you avoid ReDoS, subroutines and subroutine definition groups which enable powerful subpattern composition, and context-aware interpolation of RegExp
instances, escaped strings, and partial patterns.
Run npm install regex
in your JavaScript project and then simply import {regex} from 'regex'
to get started. Check out examples and more on GitHub.
Regex Colorizer is a project that highlights regex syntax, for use in blogs, docs, and regex tools. I created it for old-school RegexPal back in 2007, but it hadn't received any updates since 2010. Until now. Version 1.0 is a significant update that improves its API and adds support for modern JavaScript regex syntax and flags. Check out the demo!