A JavaScript library for building and composing maintainable regular expressions with ReDOS protection.
compose-regexp.js is a JavaScript library that allows developers to build and compose regular expressions in a maintainable way. It provides combinators and utilities to construct regex patterns programmatically, helping to avoid common issues like ReDOS attacks and improving code readability.
JavaScript developers who work with complex regular expressions and need safer, more maintainable pattern construction, particularly in security-sensitive or text-processing applications.
It offers a functional approach to regex construction with built-in ReDOS protection, automatic back reference management, and character set operations, making it a robust alternative to manual string concatenation or error-prone regex literals.
Build and compose maintainable regular expressions in JavaScript.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides atomic matching to prevent exponential backtracking, directly addressing security vulnerabilities like ReDOS attacks with helper functions.
Supports intersection, union, difference, and complement on character classes, enabling complex Unicode and script-specific patterns as shown in the Greek letter example.
Automatically adjusts numbered back references when composing regexps and offers ref() for programmatic control, reducing errors in complex patterns.
Manages regex flags across compositions and inserts non-capturing groups automatically, making regexps modular and reusable without manual string concatenation.
Cannot mix case-insensitive (i) and case-sensitive patterns without native engine support, a limitation admitted in the README's flag handling section.
Relies on newer RegExp features like Unicode flags and lookbehind assertions, which may not be available in all environments, restricting use in legacy systems.
Atomic matching adds unnamed capturing groups, which can disrupt match indices and complicate string splitting operations, as noted in the atomic matching section.