# google/re2j

linear time regular expression matching in Java

Repository: https://github.com/google/re2j
Canonical: https://ross.abutalabs.com/products/re2j
Language: Java
License: NOASSERTION
License Family: other
Topics: java, regular-expressions
Last push: 2026-05-22T14:44:22+00:00

## Health v2 (maintenance only)
Score: 60/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 83, release rhythm 8, longevity 100
- inputs: {"age_days": 4215, "days_push": 103, "days_rel": 601, "gap_med": null, "n_releases_24m": 1}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1255, forks 162 (observed 2026-08-28T04:04:08.845752+00:00)

## What it is
RE2/J is a pure Java port of Google's RE2 regular expression engine that guarantees linear-time matching using a nondeterministic finite automaton. It protects applications from catastrophic backtracking (ReDoS) when evaluating regex patterns, especially those from untrusted sources.

## Use cases
- prevent regex denial of service from user-supplied patterns
- match regular expressions in linear time on large inputs
- replace java.util.regex for patterns with heavy alternation
- safely evaluate untrusted regex patterns in a web application
- avoid exponential backtracking in Java regex matching

## When to choose
- your patterns have deep alternation and java.util.regex may backtrack exponentially
- you accept regex patterns from untrusted users and need ReDoS protection
- you need predictable worst-case matching time on large inputs

## When to avoid
- you rely on backreferences or PCRE-specific features
- you need a drop-in java.util.regex replacement with full API parity
- you use flags like CANON_EQ, COMMENTS, or UNICODE_CASE

## Facets
- artifact type: library
- maturity: active
- function: parser, security
- domain: parsers, security, developer-tools
- platform: jvm
- tags: regex, re2, linear-time, regex-dos, pure-java

## Member repositories
- google/re2j (main) score 60

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:08.845752+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:07:19.693750+00:00, confidence not recorded.
  - readme: https://github.com/google/re2j (fetched 2026-08-28T04:04:08.845752+00:00, sha b05c7d28f34b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
