{
  "id": "enwiki-001368386410",
  "slug": "re2-software",
  "title": "RE2 (software)",
  "qid": "",
  "lead": "RE2 is a C++ software library which implements a regular expression engine . It uses finite-state machines, in contrast to most other regular expression libraries. RE2 requires a minimum C++ version of C++17, and uses the Abseil library by Google. RE2 was implemented by Google and Google uses RE2 for Google products. RE2 uses an \"on-the-fly\" deterministic finite-state automaton algorithm based on Ken Thompson's Plan 9 grep. It is designed to avoid ReDoS (regex denial of service) attacks.",
  "body": "RE2 is a C++ software library which implements a regular expression engine . It uses finite-state machines, in contrast to most other regular expression libraries. RE2 requires a minimum C++ version of C++17, and uses the Abseil library by Google. RE2 was implemented by Google and Google uses RE2 for Google products. RE2 uses an \"on-the-fly\" deterministic finite-state automaton algorithm based on Ken Thompson's Plan 9 grep. It is designed to avoid ReDoS (regex denial of service) attacks. import ; import std; using std::string; using re2::RE2; int main(int argc, char* argv[]) { string text = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!\" string pattern = \"(a+)+$\"; bool match = RE2::FullMatch(text, pattern); std::println(\"Match result: {}\", match); } ==Related libraries== RE2 comes with a built-in Python wrapper, available on Python Package Index (PyPI) as google-re2 . The built-in regexp package in Go uses the same patterns and implementation as RE2, though it is written in Go. This is unsurprising, given Go's common staff from the Plan 9 team. The RE2 algorithm has been rewritten in Rust as the package regex . CloudFlare's web application firewall uses this package because the RE2 algorithm is immune to ReDoS. Russ Cox also wrote RE1, an earlier regular expression based on a bytecode interpreter. OpenResty uses a RE1 fork called \"sregex\". There is an official Java binding, called RE2J ( com.google.re2j ). The following languages have unofficial bindings: C (cre2) D (re2d) Erlang (re2) Inferno (inferno-re2) JavaScript (RE2JS), a port of RE2J to JavaScript Node.js (node-re2) OCaml (re2) Perl (re-engine-RE2) R (re2) Ruby (re2) WebAssembly (re2-wasm) ==See also== Comparison of regular expression engines ==References==",
  "categories": [
    "22948264",
    "23117742",
    "23603337",
    "26220375",
    "30181013",
    "45928217"
  ],
  "license": "CC BY-SA 4.0",
  "source_uri": "https://en.wikipedia.org/w/index.php?oldid=1368386410",
  "content_hash": "",
  "created_at": null,
  "updated_at": 1786210537.0,
  "claims": [],
  "contradictions": [],
  "confidence": 0.6,
  "csl": {
    "id": "enwiki-001368386410",
    "type": "webpage",
    "title": "RE2 (software)",
    "author": [
      {
        "family": "Anticloud FZ LLE",
        "literal": "Anticloud FZ LLE"
      }
    ],
    "container-title": "encyclopegia.org",
    "publisher": "Anticloud FZ LLE",
    "publisher-place": "Dubai, United Arab Emirates",
    "URL": "https://encyclopegia.org/a/re2-software",
    "issued": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "accessed": {
      "date-parts": [
        [
          2026,
          11,
          21
        ]
      ]
    },
    "license": "CC BY-SA 4.0",
    "DOI": "eo1:enwiki-001368386410",
    "isBasedOn": "https://en.wikipedia.org/w/index.php?oldid=1368386410",
    "note": "Immutable snapshot enwiki-001368386410"
  }
}