unstale

npm / re2js

re2js

What changed in re2js 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.

2 breaking4 security12 new APIs and options6 performance4 behavior and defaults1 tooling19 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.1.1 on npm

re2js 239 changes

Breaking changes 2

  • Pass true for the new javaMode flag to opt into the previous Java-style escaping and invalid capture group exceptions.

    2.0.0release notes

  • replaceAll and replaceFirst now use native ECMAScript replacement semantics by default: $$ escapes a dollar sign, and backslash is treated literally.

    2.0.0release notes

Security 2

New APIs and options 8

  • Adds a new exec method.

    2.8.5release notes

  • RE2Set now supports customizing its memory limit.

    2.8.3release notes

  • Supports more Unicode categories, including Emoji, Emoji_Component, Emoji_Modifier, and ASCII_Hex_Digit.

    2.8.2release notes

  • replaceAll() now accepts a function as replacement in addition to a string.

    2.8.0release notes

  • replaceFirst() now accepts a function as replacement in addition to a string.

    2.8.0release notes

  • Added the matchAll method.

    2.6.0release notes

  • Added a tagged template literal method for constructing regular expressions.

    2.5.0release notes

  • RE2 lookbehinds are supported.

    2.2.0release notes

Performance 6

  • Fixes quadratic-time behavior when LOOKBEHINDS is used with repeated-matching APIs such as matcher().find() in a loop, matchAll(), split(), and matcher().replaceAll().

    2.8.7release notes

  • Removes O(n) array copying during UTF-8 encoding.

    2.8.6release notes

  • Optimizes the per-byte spawning loop for the LOOKBEHINDS flag.

    2.7.1release notes

  • Word boundaries are faster.

    2.3.2release notes

  • Added an Aho-Corasick prefilter.

    2.2.1release notes

  • Performance improvements for DFA may improve regular expression execution speed.

    2.0.1release notes

Behavior and default changes 4

Fixes and other changes 17

re2js 19 changes

Security 2

  • Fixes information disclosure and XSS in Matcher.quoteReplacement.

    1.3.3release notes

  • Instance and static matches() methods use the testExact() DFA fast-path, providing a significant performance boost and ReDoS immunity.

    1.3.2release notes

New APIs and options 4

  • Adds high-performance boolean testing with test(), offering a faster alternative to matcher.find() for checking whether a pattern matches.

    1.3.1release notes

  • Adds a high-performance boolean testing method for exact matching.

    1.3.1release notes

  • Introduced lazy DFA.

    1.3.0release notes

  • Adds a Matcher export for TypeScript consumers.

    1.2.3release notes

Tooling 1

Fixes and other changes 2