A template tag for readable, high-performance native JavaScript regexes with extended syntax, context-aware interpolation, and always-on best practices.
Regex+ is a JavaScript library that provides a `regex` template tag for creating native `RegExp` instances with enhanced syntax, safety, and readability. It modernizes JavaScript regular expressions by adding features like atomic groups, possessive quantifiers, subroutines, and definition groups, while enforcing best-practice flags by default to prevent common pitfalls like ReDoS.
JavaScript developers who work with complex regular expressions and need improved maintainability, safety against catastrophic backtracking, and features comparable to other major regex flavors like PCRE and Perl.
Developers choose Regex+ because it returns native `RegExp` instances for native performance while adding powerful features that make regexes more readable, composable, and robust. Its always-on best practices (flags v, x, n), context-aware interpolation, and extended syntax help avoid bugs and ReDoS, positioning JavaScript as a top-tier regex flavor.
JS regexes ➕ future. A template tag for readable, high-performance, native JS regexes with extended syntax, context-aware interpolation, and always-on best practices.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implicit flag x allows whitespace and comments within patterns, making complex regexes like the refactored date/time example dramatically easier to read and maintain.
Atomic groups and possessive quantifiers eliminate catastrophic backtracking, improving performance and security against attacks, as highlighted in the README's examples.
Subroutines and definition groups enable subpattern reuse and grammatical patterns, similar to PCRE, allowing for maintainable complex regexes without duplication.
Context-aware interpolation of strings, patterns, and RegExp instances automatically escapes special characters and adjusts backreferences, preventing common bugs and over-escaping issues.
Without the Babel plugin, regexes are transpiled at runtime, adding a performance cost and bundle size increase, which can be significant for performance-sensitive applications.
To eliminate runtime overhead, users must integrate the Babel plugin, adding complexity to the build process and requiring additional configuration, which may not fit all workflows.
Features like atomic groups and subroutines are not standard in JavaScript and require developers to learn new syntax, potentially slowing adoption in teams familiar only with vanilla regex.
Relies on modern JavaScript features like flag v and regex modifiers; in older environments, it may throw errors or require workarounds, limiting use in legacy systems without transpilation.