RE2 Regular Expression Engine

RE2 Regular Expression Engine

github.com

5

About this website

RE2 is a fast, safe, thread-friendly regular expression engine developed by Google. Created by Russ Cox in 2010, RE2 has over 9,000 stars as of 2026 and is used in Google Code Search, Chromium, gRPC, and Prometheus. Unlike traditional backtracking regex engines (PCRE, Python re, Ruby Regexp) with exponential worst-case complexity, RE2 guarantees linear time O(n) matching using finite state machine (NFA or DFA) approaches. Key features include: linear-time guarantee (all operations complete in time proportional to input length, eliminating ReDoS vulnerabilities from catastrophic backtracking), memory efficiency (building DFA states on-the-fly with configurable memory budget), Perl-like syntax (supporting character classes, alternation, repetition, grouping, and Unicode properties), submatch extraction (providing capture group positions via Match API), Unicode support (full character class support including case-insensitive matching), named capture groups, POSIX and leftmost-first semantics, thread safety (objects safe for concurrent use by multiple threads), C++ and Go APIs (available as C++ library and part of Go standard library regexp package), configurable options (case sensitivity, longest match mode, and maximum DFA states), and broad adoption across Google internal systems and open-source projects.

Tags & Categories

Statistics

5
Views
0
Clicks
0
Like
0
Dislike

Comments

Log In to post a comment

No comments yet. Be the first!