RegexEditor.dev Logo

Regex Editor & Tester

Go Regex Tester

Test Go regular expressions against the real RE2 engine — compiled to WebAssembly and running in your browser.

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

"
"

Test your Go regex in the editor below

Go regex: what makes it different

No lookaround
Go rejects (?=…) and (?<=…) at compile time. Test your pattern here before adding it to your code.
No backreferences
\1-style backreferences are not part of RE2. Patterns that rely on them must be restructured.
Linear time
RE2 guarantees O(n) matching, so a pattern can never hang your service the way catastrophic backtracking can in PCRE.
Named groups
Go uses (?P<name>re) — with the P — unlike most other flavors.

Go's regexp package uses Google's RE2 engine, which behaves very differently from Perl-style engines: no backreferences, no lookahead or lookbehind, and a linear-time matching guarantee that makes catastrophic backtracking impossible. Most online testers simulate these rules with JavaScript regex and silently accept patterns Go would reject — or worse, report matches Go could never produce.

This tester runs the actual RE2 algorithm compiled to WebAssembly, so what you see here is exactly what your Go code will do, including RE2's leftmost-first match semantics, (?P<name>…) named capture groups, and Unicode-aware \p{…} classes.

Go regex FAQ

Does Go regex support lookahead or lookbehind?

No. Go's regexp package is built on RE2, which deliberately omits lookahead (?=…), negative lookahead (?!…) and all lookbehind forms, along with backreferences. Patterns using them return an error when compiled. RE2's authors traded those features for a linear-time guarantee.

Which engine does Go use for regular expressions?

Go uses RE2 (Google's regex engine). The syntax is documented as "regexp/syntax". This tester runs the same engine compiled to WebAssembly, so results match what your Go program will produce.

Is Go regex the same as PCRE?

No. They share the basic syntax (character classes, quantifiers, anchors, groups), but Go/RE2 has no backreferences or lookaround, and PCRE offers many constructs (recursion, possessive quantifiers, callouts) that RE2 does not.