Formatters & Code
Google Regex Tester & Filter Workbench
Test GSC and GA4 regex with RE2JS compatibility. Import CSV metrics, compare weighted filter coverage, find overlaps and simulate first-rule assignment locally.
Does Google support regex?
Google Search Console and GA4 support regular expressions in report filters. This tester helps check those filters; they are separate from searches typed into the ordinary Google Search box.
For example, in Search Console choose a Query filter, Custom (regex), and enter shoes|boots to match queries containing either word. Test red shoes, winter boots and sandals in Search Console mode here: the first two should match and the third should not. Use ^(shoes|boots)$ when only those complete query values should match. GA4 full-match filters require you to account for the entire value instead.
Follow the GSC and GA4 regex guide for platform-specific examples and unsupported syntax.
Results
What the result means
Google Search Console and Google Analytics 4 rely on Google's open-source RE2 regular expression engine instead of standard JavaScript or PCRE engines. RE2 operates in guaranteed linear time relative to input length, eliminating catastrophic backtracking to protect shared cloud infrastructure against Regular Expression Denial of Service (ReDoS). Consequently, RE2 rejects advanced PCRE features including positive lookaheads, negative lookaheads, lookbehinds, and backreferences. Furthermore, Google platforms enforce different string boundary rules: Search Console filters use partial substring matching by default, while GA4 Custom Channel Groupings require full-string matching unless wildcards are explicitly included. This validator tests your expressions using RE2JS, a JavaScript port of RE2, on your device.
The table below summarizes the core differences between Google Search Console, Google Analytics 4, and standard JavaScript regular expressions:
| Feature | Google Search Console | GA4 Channel Groups | GA4 Explorations | Standard JS Regex |
|---|---|---|---|---|
| Engine | RE2 (linear time) | RE2 (linear time) | RE2 (linear time) | ECMAScript / V8 |
| Default match | Partial (substring) | Full (entire string) | Partial or Full | Substring search; g returns all matches |
Lookaround (?=...) | ❌ Syntax error | ❌ Syntax error | ❌ Syntax error | ✔ Supported |
Backreferences \1 | ❌ Syntax error | ❌ Syntax error | ❌ Syntax error | ✔ Supported |
| Match "shoes" on "red shoes sale" | ✔ Matches directly | ❌ Fails (needs .*shoes.*) | ✔ With partial mode | ✔ Matches directly |
| Case sensitivity | Configurable toggle | Case-insensitive | Configurable | Flag /i |
Related tools
Guides
Questions
Does Google support regex?
Google Search Console and Google Analytics 4 support regex filters for their reports. They use RE2-compatible syntax, with matching rules that depend on the product and filter. These report filters are separate from the ordinary Google Search box. Choose the matching platform mode here and test a few known matches and non-matches before copying a pattern into a report.
Why did my regex work in a standard tester but fail in Google Search Console?
Standard online regex testers run native JavaScript or PCRE engines that support lookaround assertions (?=...), (?<=...) and backreferences (\1). Google Search Console runs Google's RE2 engine, which intentionally disables these constructs to guarantee linear-time execution and prevent catastrophic backtracking. Our tool evaluates expressions directly against RE2 syntax rules so you catch these incompatibilities before deploying filters.
Why do regular expressions in GA4 Custom Channel Groupings fail without wildcards?
GA4 Custom Channel Groupings evaluate regular expressions using full-string matching. If you enter openai\.com as a source filter, GA4 will only match the exact literal string 'openai.com'. It will not match 'https://openai.com', 'chat.openai.com', or referral URLs unless you explicitly wrap the pattern with leading and trailing wildcards like .*openai\.com.*.
How does Search Console regex matching differ from GA4?
Google Search Console regex filters use partial substring matching by default. Entering 'shoes' in GSC matches 'red shoes', 'running shoes sale', and 'shoes online' without needing wildcard asterisks. To enforce an exact match in GSC, you must explicitly anchor both ends of the pattern with ^ and $ (e.g. ^shoes$).
How do I filter out branded keywords in Google Search Console?
To exclude branded queries, select the 'Doesn't match regex' filter option in Search Console and enter your brand variations separated by vertical pipes, such as \b(brand|brandname|misspelling)\b. Using word boundary markers (\b) prevents accidentally filtering unrelated terms that happen to contain your brand characters.
What is the difference between 'Matches regex' and 'Matches partial regex' in GA4?
In GA4 custom reports and explorations, 'Matches regex' requires a full match of the entire dimension value from start to finish, equivalent to ^pattern$. 'Matches partial regex' matches any substring within the value, functioning identically to Google Search Console default regex behavior.