NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #2810 most downloaded on npm
Convert Oniguruma patterns to native JavaScript RegExp
Last release 5 months ago
19 Apr 2026
Ships unpredictably
gaps range from 2 weeks to 7 months
Nearly every release is documented
notes for 32 of 34 stable releases
2 versions withdrawn
withdrawn after publishing
2 years old
36 releases · first in 2024
One column per month.
Prevented a "Maximum call stack size exceeded" timeout that could occur with some edge case uses of overlapping recursive subroutines.
] to be more accurate/helpful. — Via the parser upgrade[oniguruma-parser: ^0.12.2]
Prevented environment tests from being replaced with constants when bundled with Rolldown. ( #42 , @xiaweiss )
Worked around partial/incomplete flag v support in mobile QQ. ( #41 , @wststone )
Worked around a Safari (WebKit) bug with nested negated character classes.
[oniguruma-parser: ^0.12.1]
Worked around a Safari (WebKit) bug with character classes that contain both nested classes and an escaped hyphen as the last node.
Worked around a parser bug in Bun ≤ 1.1.34.
Shortened the generated source for \X when target is ES2018 .
\X when target is ES2018.y{g} as a top-level flag.onig:match command line script, used for testing and comparing Oniguruma results.[oniguruma-parser: ^0.12.0]
This release included a significant migration from oniguruma-parser 0.5.4 → 0.11.0.
This release included a significant migration from oniguruma-parser 0.5.4 → 0.11.0.
(*FAIL).no-compare option to the onig:match command-line script.? quantifier no longer ignores the ?. — Via the parser upgrade[oniguruma-parser: ^0.11.0]
Added partial support for nested, negated classes with target ES2018 (supports top-level-nested, negated classes in non-negated classes).
target ES2018 (supports top-level-nested, negated classes in non-negated classes).
[oniguruma-parser: ^0.5.4]
Bumped the oniguruma-parser dependency to fix a bundle size regression.
[oniguruma-parser: ^0.5.2]
The oniguruma-parser library was recently seeded by splitting off half of this library's code (the tokenizer, parser, and traverser), and it has gone
The oniguruma-parser library was recently seeded by splitting off half of this library's code (the tokenizer, parser, and traverser), and it has gone through several releases to prepare for primetime. This version of Oniguruma-To-ES formally removes its old parsing code, migrating to the new and improved standalone parser.
toOnigurumaAst. Its functionality has moved to oniguruma-parser, which includes many improvements, new features, and changes to the AST structure.toRegExp/toRegExpDetails: Throw if the second argument isn't an object or undefined.cntrl, graph, print.<sub>[oniguruma-parser: ^0.5.1]</sub>
Improved error messages for invalid and unsupported group types/options.
target ES2024 or later. (#30)Added support for lazy compilation of regexes (hat-tip @jeff-hykin for the idea).
lazyCompile in EmulatedRegExp.lazyCompileLength in toRegExp/toRegExpDetails allows triggering the use of lazy compilation based on the length of the transpiled pattern.toOnigurumaAst: Allow compile-time option rules.singleline (already supported by toRegExp/toRegExpDetails).…have changed for subclassed regexes. Since a breaking change was needed, various names were also changed to improve clarity and consistency.
This includes a deep change that was mostly under the hood (how metadata about capturing groups is provided when using subclass-based emulation), but required a major release since serialized values have changed for subclassed regexes. Since a breaking change was needed, various names were also changed to improve clarity and consistency.
toDetails as toRegExpDetails.OnigurumaToEsOptions as ToRegExpOptions.OnigurumaToEs.EmulatedRegExp: Metadata for hidden/transfer captures no longer embedded in the pattern; provided via options.rawArgs property of EmulatedRegExp instances; replaced with rawOptions. The pattern and flags properties of rawArgs are no longer needed for serialization.EmulatedRegExp subclass.: were treated as invalid POSIX classes. (#23)Added support for absent repeaters (?~…).
(?~…). (#13)Added option rules.singleline (Oniguruma compile-time option ONIG_OPTION_SINGLELINE).
rules.singleline (Oniguruma compile-time option ONIG_OPTION_SINGLELINE).
^ as \A and $ as \Z.Restored support for subclass-based \G emulation in strict accuracy mode, for patterns without lookbehind.
\G emulation in strict accuracy mode, for patterns without lookbehind.\K directives.This release brings full support for Oniguruma's \G anchor (which has no direct equivalent in JavaScript). This is a very flexible anchor, and previou
This release brings full support for Oniguruma's \G anchor (which has no direct equivalent in JavaScript). This is a very flexible anchor, and previous versions supported some but not all ways that it could be used.
\G have been combined into a new strategy.
EmulatedRegExp constructor with details serialized from a previous version of this library.accuracy mode no longer allows subclass-based emulation of \G.\G anchor via subclass-based emulation.\G in some positions where it can never match and forces backtracking (without the need for subclass-based emulation).rules.ignoreUnsupportedGAnchors since it's no longer useful.\G that could lead to mismatches with some target strings.Most of the changes and fixes in this release resulted from feedback by @RedCMD. ✨
Most of the changes and fixes in this release resulted from feedback by @RedCMD. ✨
Note that every fix and newly-supported syntax in this release addresses an extreme edge case that did not affect even one regex in the tens of thousands of Oniguruma regexes found in the TextMate grammars provided by Shiki.
20 (rather than an infinite or high-value depth like other regex flavors). (#19)
maxRecursionDepth to rules.recursionLimit.recursionLimit from 5 to 20.recursionLimit from 100 to 20.accuracy to 'strict' no longer disables recursion.\x{…} values above 10FFFF at the end of character class ranges. (#22)target ES2024 or later and option verbose not enabled).toDetails: The subclass property on result objects was renamed as options, for consistency with EmulatedRegExp.
toDetails: The subclass property on result objects was renamed as options, for consistency with EmulatedRegExp.rawArgs property to EmulatedRegExp instances that can be used to serialize the object.\G in any top-level alternative.target auto to use ES2025.EmulatedRegExp types.target ES2025: Subpattern details on match results did not match Oniguruma in some cases when duplicate group names were used across mutually exclusive alternation paths. Results are now the same across all targets. (#14)ES2025 targets: Duplicate characters were added in edge cases during mixed case-insensitivity expansion of character class ranges that included the same character in multiple cases. This had no effect on resulting matches, but generated regex source is now cleaner in these cases.Option allowUnhandledGAnchors renamed as ignoreUnsupportedGAnchors.
allowUnhandledGAnchors renamed as ignoreUnsupportedGAnchors.target. (#10)avoidSubclass is not enabled:
When the following conditions were *all* met, the indices values of result arrays could be incorrect.
indices values of result arrays could be incorrect.
hasIndices and global both enabled.(^|\G) or similar.lastIndex greater than 0.When option allowUnhandledGAnchors is enabled, an unsupported use of \G no longer adds flag y (provides better tradeoffs).
allowUnhandledGAnchors is enabled, an unsupported use of \G no longer adds flag y (provides better tradeoffs).rules.captureGroup (equivalent to Oniguruma compile-time option ONIG_OPTION_CAPTURE_GROUP) to toDetails, toRegExp, and toOnigurumaAst. Allows unnamed captures and numbered backreferences/subroutines when using named capture (with complex resulting rules in edge cases).^ from matching after a string-terminating line feed. (#9)avoidSubclass is not enabled, use emulation groups (which prevent captured values from appearing on match results) for copies of capturing groups created by recursion.Added support for backreferences in patterns with recursion, in cases when the recursed subpattern doesn't contain captures.
] in character classes.With target ES2018, some advanced patterns that contained \[ within a character class were resulting in invalid syntax.
target ES2018, some advanced patterns that contained \[ within a character class were resulting in invalid syntax. (#5)Replaced option accuracy: 'loose' with rules.allowUnhandledGAnchors.
accuracy: 'loose' with rules.allowUnhandledGAnchors.tmGrammar with rules.allowOrphanBackrefs.D (Digit is ASCII) and S (Space is ASCII) at top-level.rules.asciiWordBoundaries.\w, \d, \s, and their inversions are Unicode-based by default. (#4)\b word boundaries by default.Added support for flag W (Word is ASCII) at top-level.
W (Word is ASCII) at top-level.Worked around a parser bug in versions of Bun prior to v1.1.35.
Changed the shape of toDetails results when subclass details are included.
toDetails results when subclass details are included.EmulatedRegExp automatically adjusts subpattern matches and indices to account for injected emulation groups.EmulatedRegExp for patterns with atomic groups or possessive quantifiers, unless option avoidSubclass is enabled.target option 'auto' (hat-tip @antfu for the idea).\G support so it works with additional patterns.ſ, U+017F).Changed the default maxRecursionDepth from 6 to 5.
maxRecursionDepth from 6 to 5.\G emulation.Changed target value ESNext to ES2025. The features used are all slated for ES2025.
target value ESNext to ES2025. The features used are all slated for ES2025.\y, \Y.\177.\o{…}.Nothing published for this version
Improved handling of backreferences to nonparticipating captures.
\g or \k with following < or ' is an error.Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →