Adds recursive matching support to JavaScript regular expressions by generating native `RegExp` patterns, with recursion limited to a specified maximum depth (N, 2 to 100). Useful for expressing patterns like balanced parentheses, palindromes, or equal counts where recursion helps model nested or self-referential structure.
Project status
- Maintenance status: The repository shows recent upstream activity (last upstream push on 2026-05-12), but the last published updates in the provided history are tagged only up to v6.0.2 (2025-02-01), so maintenance looks intermittent rather than continuously release-driven.
- Update cadence: There was relatively fast iteration in late 2024 to early 2025 (multiple v4.x and v5.x updates in November to December 2024, then v6.0.0 to v6.0.2 across late January to early February 2025). After that, there is a long gap until the next evidence of upstream work in 2026 (but no corresponding tagged updates are shown here).
AI summary generated 2026-06-09
Recent updates
v6.0.2
2025-02-01v6.0.2 contains a fix for a capture transfer edge case in the recursion plugin. The change is implemented in the core capture-transfer mapping logic and is reflected by updates to the recursion specs and expected capture index handling.
v6.0.1
2025-01-31v6.0.1 updates the recursion plugin’s capture transfer behavior so it records all expanded captures that can transfer, not just the last one. It also addresses capture transfer edge cases. In practice, the code changes also introduce a notable API shape change for the `captureTransfers` option, which is not mentioned in the release notes.
Featuresv6.0.0
2025-01-29v6.0.0 upgrades regex-recursion to the Regex+ 6.0.0 plugin API and reworks recursion so it can interoperate with the Oniguruma-To-ES capture transfer mechanism. It also introduces a new `mode` option with `plugin` (default) and `external` behaviors when calling `recursion` directly.
Featuresv5.1.1
2024-12-26Release v5.1.1 contains a targeted edge case fix related to capturing groups that use transfer markers. The change is implemented in the recursion plugin logic that rewrites capture groups when emulation groups are enabled, and it also bumps the underlying `regex` dependency to v5.1.1.
v5.1.0
2024-12-26v5.1.0 extends the recursion plugin to support recursion of Regex+ emulation groups, including cases where hidden and transfer markers are present inside the recursive subpatterns. The implementation adds logic to measure and detect emulation group markers in the expression so recursion depth parsing stays consistent when those markers are injected or already exist.
Featuresv5.0.0
2024-12-19v5.0.0 updates the regex-recursion plugin to adjust how captures are produced when the `subclass` option is enabled, specifically preventing duplicate captures from appearing in result arrays. The code diff also introduces an internal “emulation groups” mechanism that changes how the plugin rewrites regex source during recursion expansion.
v4.3.0
2024-11-27v4.3.0 updates the recursion plugin to support numbered backreferences in more cases. Specifically, numbered backrefs are now allowed when the recursed subpattern does not contain capturing groups, while still being rejected for certain recursion forms.
Featuresv4.2.1
2024-11-13v4.2.1 is a small patch release focused on fixing recursion by number behavior in the regex-recursion plugin. The diff suggests both a parsing/tokenization adjustment and a behavioral change enforced via a new spec assertion.
v4.2.0
2024-11-12Release v4.2.0 adds support for using multiple recursive subroutines within the same regex, as long as those recursions are non-overlapping. The implementation changes the recursion parser behavior to track recursion usage and reject overlapping recursion patterns.
Featuresv4.1.0
2024-11-04v4.1.0 adds support for subpattern recursion via group number (in addition to group name), plus build output improvements like generating a .d.ts file and a sourcemap for the browser bundle. It also tightens validation around recursion depth and fixes cases where duplicate recursion could lead to invalid generated regex syntax.
Features