# What changed in re2js

> 48 changes in re2js 1 to 2 from its official release notes, upgrade guides and advisories: 2 breaking, 4 security, 12 new APIs and options. Each one cited. Sources checked 2026-10-17. HTML: https://unstale.sh/npm/re2js/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## re2js 2

### Breaking changes

- Pass true for the new javaMode flag to opt into the previous Java-style escaping and invalid capture group exceptions. (2.0.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.0.0)
- replaceAll and replaceFirst now use native ECMAScript replacement semantics by default: $$ escapes a dollar sign, and backslash is treated literally. (2.0.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.0.0)

### Security

- Includes small security fixes. (2.8.7) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.7)
- Fixed prototype pollution in getNamedGroups. (2.1.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.1.1)

### New APIs and options

- Adds a new exec method. (2.8.5) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.5)
- RE2Set now supports customizing its memory limit. (2.8.3) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.3)
- Supports more Unicode categories, including Emoji, Emoji_Component, Emoji_Modifier, and ASCII_Hex_Digit. (2.8.2) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.2)
- replaceAll() now accepts a function as replacement in addition to a string. (2.8.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.0)
- replaceFirst() now accepts a function as replacement in addition to a string. (2.8.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.0)
- Added the matchAll method. (2.6.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.6.0)
- Added a tagged template literal method for constructing regular expressions. (2.5.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.5.0)
- RE2 lookbehinds are supported. (2.2.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.0)

### Performance

- 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.7) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.7)
- Removes O(n) array copying during UTF-8 encoding. (2.8.6) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.6)
- Optimizes the per-byte spawning loop for the LOOKBEHINDS flag. (2.7.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.7.1)
- Word boundaries are faster. (2.3.2) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.3.2)
- Added an Aho-Corasick prefilter. (2.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.1)
- Performance improvements for DFA may improve regular expression execution speed. (2.0.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.0.1)

### Behavior and default changes

- translateRegExp() now supports native Regex. (2.3.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.3.0)
- DFA cache eviction is now granular. (2.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.1)
- The Unicode mapping is updated to version 17. (2.2.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.0)
- Improves the RE2Set feature. (2.1.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.1.0)

### Fixes and other changes

- Fixes bugs in replace. (2.8.6) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.6)
- Fixes bugs in split. (2.8.6) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.6)
- Fixes the types for resetMatcherInput. (2.8.5) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.5)
- Fixes polymorphic inputs to resetMatcherInput. (2.8.4) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.4)
- Fixes TypeScript types for more methods. (2.8.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.8.1)
- Adds AST SyntaxError validation for the LOOKBEHINDS flag, helping identify invalid syntax. (2.7.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.7.0)
- Fixed a desynchronization bug in matchAll. (2.6.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.6.1)
- Fixes Unicode case folding across all JavaScript environments. (2.4.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.4.0)
- Fixes were made to the TypeScript declaration files. (2.3.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.3.1)
- TypeScript type fixes were made. (2.3.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.3.0)
- Fixes were made to translateRegExp(). (2.2.3) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.3)
- Unicode fixes may change how regular expressions handle Unicode. (2.2.3) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.3)
- Fixes issues that cause “Maximum call stack size exceeded.” (2.2.2) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.2)
- Fixed a compiler memory leak. (2.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.1)
- Fixed onepass logic. (2.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.1)
- Zero-width matches no longer corrupt UTF-8 or UTF-16. (2.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.1)
- The RE2Set flags interface is fixed. (2.2.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/2.2.0)

## re2js 1

### Security

- Fixes information disclosure and XSS in Matcher.quoteReplacement. (1.3.3) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.3.3)
- Instance and static matches() methods use the testExact() DFA fast-path, providing a significant performance boost and ReDoS immunity. (1.3.2) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.3.2)

### New APIs and options

- Adds high-performance boolean testing with test(), offering a faster alternative to matcher.find() for checking whether a pattern matches. (1.3.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.3.1)
- Adds a high-performance boolean testing method for exact matching. (1.3.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.3.1)
- Introduced lazy DFA. (1.3.0) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.3.0)
- Adds a Matcher export for TypeScript consumers. (1.2.3) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.2.3)

### Tooling

- TypeScript support was improved. (1.2.2) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.2.2)

### Fixes and other changes

- The return type of end was fixed. (1.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.2.1)
- The return type of start was fixed. (1.2.1) — [release notes](https://github.com/le0pard/re2js/releases/tag/1.2.1)
