Regex Tester
Test regular expressions against specific engine flavors. The flavor selector is the primary choice — different engines support different constructs, and results from the wrong engine can be silently incorrect. v1 supports Go RE2. The tool runs in the browser using JavaScript's regex engine, detects RE2-incompatible constructs, and warns you before evaluation so you are never looking at results that Go would never produce.
Go RE2 is the regex engine used by Go's regexp package. It guarantees linear-time matching by forbidding constructs that require backtracking: lookaheads, lookbehinds, backreferences, possessive quantifiers, and atomic groups are not supported.
Important: This tool runs in the browser. Evaluation uses JavaScript's regex engine, not Go's. If your pattern uses RE2-incompatible constructs, you will see a warning and the results will reflect JavaScript behavior, not what Go would produce.
Flags in RE2 are embedded in the pattern using (?flags) syntax. Common flags: (?i) case-insensitive, (?m) multiline, (?s) dot matches newline.
Named captures use (?P syntax in RE2. This tool accepts both (?P and the JavaScript form (?.
PCRE support is coming soon.
PCRE2 support is coming soon.
Examples
RE2 Compatibility Warnings
Invalid pattern
Results
match(es) found
Named Capture Groups
| Group | Value |
|---|---|
Frequently Asked Questions
Why does this tool warn me about lookaheads if I'm testing a Go regex?
Go's regexp package uses the RE2 engine, which does not support lookaheads ((?=...), (?!...)), lookbehinds, backreferences, or possessive quantifiers. RE2 guarantees linear-time matching by design, and these constructs require backtracking, which violates that guarantee. If you paste a pattern with a lookahead into Go's regexp.Compile, it returns an error at runtime. This tool detects those constructs before evaluation and warns you, rather than silently running the pattern through JavaScript's engine and giving you results that Go would never produce.
Does this tool actually run Go code?
No. The tool runs entirely in the browser using JavaScript's built-in RegExp. It simulates Go RE2 behavior by detecting patterns with RE2-incompatible constructs and warning you, and by translating RE2-specific syntax (like (?P named captures) into the JavaScript equivalent. The match results you see are what JavaScript produces — which is correct for RE2-compatible patterns, but will differ from Go for patterns that use unsupported constructs.
How do I set flags in a Go RE2 pattern?
In Go's regexp package, flags are embedded inside the pattern itself using (?flags) syntax. You do not pass flags as a separate argument. For example, (?i)hello matches "hello", "Hello", and "HELLO" case-insensitively. Common flags: (?i) for case-insensitive, (?m) for multiline (so ^ and $ match line boundaries), and (?s) for single-line mode (dot matches newline). You can combine them: (?im). This tool reads the embedded flags from your pattern and applies them during evaluation.
What is the difference between PCRE and RE2?
PCRE (Perl-Compatible Regular Expressions) is a different regex engine that supports a broader set of constructs than RE2, including lookaheads, lookbehinds, backreferences, and more complex features. RE2 trades those features for a guarantee that matching always completes in time proportional to the length of the input — it cannot be made to hang on a pathological input the way PCRE can. Go uses RE2. PHP (via preg_match) uses PCRE. Nginx uses PCRE. Python's re module is closer to PCRE. PCRE and PCRE2 are also distinct engines (PCRE2 is the modern rewrite) and should not be conflated. This tool plans to add PCRE and PCRE2 as separate flavor options in a future release.
Why is Vim regex not included?
Vim's regex engine is unusual because it has four distinct "magic" modes — \v (very magic), \m (magic, the default), \M (nomagic), and \V (very nomagic) — that fundamentally change which characters are metacharacters. Accurately simulating this in a browser tool requires a full Vim regex parser, not just a flag translation. It is deferred to a future release rather than included with incorrect or partial behavior.
