RegexEditor.dev Logo

Regex Editor & Tester

RE2 Regex Tester

Test patterns against Google's RE2 engine — the linear-time regex engine behind Go, compiled to WebAssembly.

Free, no signup — runs entirely in your browser on RegexEditor.dev.

"
"

Test your RE2 regex in the editor below

RE2 regex: what makes it different

Automaton-based
RE2 compiles your pattern to an NFA/DFA rather than backtracking, so worst-case time is linear in the input size.
No backreferences
Capturing text to match again later (\1) is impossible in RE2; restructure the pattern or match in two steps.
Unicode-first
\p{Han}, \p{L}, and full UTF-8 support are built in.
Two match policies
Leftmost-first (Perl-like, used by Go) and leftmost-longest (POSIX) semantics are both available.

RE2 is Google's regular expression engine, designed for production systems that cannot afford catastrophic backtracking. It powers Go's regexp package, Rust's regex crate follows the same philosophy, and C++ has RE2 bindings of its own. RE2 guarantees matching time linear in the length of the input.

Because RE2 deliberately omits backreferences and lookaround, patterns that work in PCRE often fail to compile here — and that is the point of testing: find out now, not in production. This page runs the real RE2 engine compiled to WebAssembly, entirely in your browser.

RE2 regex FAQ

What is the RE2 regex engine?

RE2 is an open-source regular expression engine developed at Google. It guarantees linear-time matching by using automata instead of backtracking, which eliminates the "evil regex" denial-of-service risk. It is the engine behind Go's regexp package and C++ libraries such as re2.

Why doesn't my PCRE pattern work in RE2?

RE2 omits backreferences (\1), lookahead (?=…), and lookbehind (?<=…). It also does not support recursion, atomic groups, or possessive quantifiers. Patterns using these constructs are rejected at compile time rather than silently mismatching.

Is RE2 faster than PCRE?

At scale, usually yes in the sense that matters: RE2's linear-time guarantee means predictable performance regardless of pattern pathology, while PCRE can exhibit exponential backtracking on adversarial patterns. For trivial patterns the difference is small; for untrusted input RE2 is the safer choice.