RE2 (software)
RE2 is a C++ software library which implements a regular expression engine .[src] It uses finite-state machines, in contrast to most other regular expression libraries.[src] RE2 requires a minimum C++ version of C++17, and uses the Abseil library by Google.[src] RE2 was implemented by Google and Google uses RE2 for Google products.[src] RE2 uses an "on-the-fly" deterministic finite-state automaton algorithm based on Ken Thompson's Plan 9 grep.[src] It is designed to avoid ReDoS (regex denial of service) attacks.[src]
RE2 is a C++ software library which implements a regular expression engine .[src] It uses finite-state machines, in contrast to most other regular expression libraries.[src] RE2 requires a minimum C++ version of C++17, and uses the Abseil library by Google.[src] RE2 was implemented by Google and Google uses RE2 for Google products.[src] RE2 uses an "on-the-fly" deterministic finite-state automaton algorithm based on Ken Thompson's Plan 9 grep.[src] It is designed to avoid ReDoS (regex denial of service) attacks.[src] 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 .[src] The built-in regexp package in Go uses the same patterns and implementation as RE2, though it is written in Go.[src] This is unsurprising, given Go's common staff from the Plan 9 team.[src] The RE2 algorithm has been rewritten in Rust as the package regex .[src] CloudFlare's web application firewall uses this package because the RE2 algorithm is immune to ReDoS.[src] Russ Cox also wrote RE1, an earlier regular expression based on a bytecode interpreter.[src] OpenResty uses a RE1 fork called "sregex".[src] There is an official Java binding, called RE2J ( com.google.re2j ).[src] 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==[src]
21 sentences · 21 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"RE2 (software)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/re2-software. Accessed 26 November 2026.
Chicago
"RE2 (software)." encyclopegia.org. Accessed November 26, 2026. https://encyclopegia.org/wiki/re2-software.
APA
encyclopegia.org. (2026). RE2 (software). Retrieved November 26, 2026, from https://encyclopegia.org/wiki/re2-software
Accessed November 26, 2026 · CC BY-SA 4.0 · citation page · JSON