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.

Platform & expression

RE2JS compatibility tester On-device

Enter pattern without enclosing slashes. Evaluated locally with RE2JS, not Google’s hosted runtime.

Queries & test run

0 queries / URLs

Paste up to 500 lines. Matches and non-matching exclusions are tested instantly on your device.

CSV coverage, filter overlap & channel precedence

Import a GSC or analytics CSV with one text dimension and optional numeric metrics. This compares single-dimension RE2JS rules, not every GA4 channel condition. Add rules from the tester above, then order them: the first matching rule receives each row. Independent coverage may overlap; assigned totals do not. No data is sent to Google.

Up to 500 rows and 3 metrics. Use exact column names and non-negative numbers without thousands separators, percentages or currency symbols. Missing/invalid values produce errors; they are never silently counted as zero.

Evidence JSON contains your CSV, rules and observed assignments for regression comparison. Recipes contain rules and column settings only. CSV exports protect formula-like cells with an apostrophe. For deployment: copy each reviewed pattern into the corresponding GSC include/exclude filter or GA4 full/partial condition; mirror case settings and rule order. Verify against a small report before relying on coverage estimates.

Brand / literal-list builder

One literal per line. Spaces and order are preserved; blank lines and exact duplicates are removed. Review the escaped pattern before applying it.

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:

FeatureGoogle Search ConsoleGA4 Channel GroupsGA4 ExplorationsStandard JS Regex
EngineRE2 (linear time)RE2 (linear time)RE2 (linear time)ECMAScript / V8
Default matchPartial (substring)Full (entire string)Partial or FullSubstring 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 sensitivityConfigurable toggleCase-insensitiveConfigurableFlag /i

Related tools

Guides

Advertisement

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.

Need help with a tool or found a bug?

Report an issue directly to engineering. No accounts required — all client data remains private on your device.

Report an Issue →