Paste a pattern. Find out whether it actually runs in Search Console, GA4 and Clarity, before you waste an afternoon wondering why a filter returns nothing.
Why this exists. Search Console and GA4 both run Google’s RE2 engine, which has no lookaheads, no lookbehinds and no backreferences. Most regex on the internet was written for PCRE or JavaScript, which have all three.
A pattern that RE2 rejects does not warn you. It returns an error you can miss, or a segment with no traffic that looks exactly like a segment with no traffic. This checks first.
Start from a working pattern
Each of these is RE2-safe. Click to load it into the checker.
What the checker is looking for
The full compatibility picture, if you would rather read it than paste something.
| Construct | Search Console | GA4 | Clarity | Do this instead |
|---|---|---|---|---|
(?!...) negative lookahead | No | No | n/a | Write the positive pattern, set the filter to Doesn’t match regex |
(?=...) positive lookahead | No | No | n/a | Rewrite as explicit alternation |
(?<=...) lookbehind | No | No | n/a | Anchor with ^ or match the whole shape |
Backreference \1 | No | No | n/a | Write the repetition out literally |
Atomic group (?>...), recursion | No | No | n/a | Not available in RE2 at all |
Possessive quantifier a*+ | No | No | n/a | Use a plain greedy quantifier |
Case flag (?i) | Yes | Yes | n/a | Put it at the very start of the pattern |
Anchors, classes, alternation, \b | Yes | Yes | n/a | Standard behaviour |
| Pattern length | 4,096 | Generous | n/a | Split a long brand list across two stacked filters |
Three differences that break a working pattern when you move it.
1. GA4’s FULL_REGEXP means whole-string. Search Console matches partially by default. The same pattern set to FULL_REGEXP in GA4 can return zero rows. Use PARTIAL_REGEXP when you are porting a GSC pattern across.
2. GA4’s case default is insensitive. This contradicts most published guidance. Tested against the Data API, an uppercase pattern matched lowercase paths until caseSensitive: true was set explicitly, at which point it returned nothing.
3. Clarity does not do regex at all. Its filters advertise matchesRegex, but metacharacters are not evaluated. A literal string matched sessions; the same string with a regex dot matched nothing, and an alternation matched nothing, with no error either time. Treat Clarity filters as literal substring matching and do any real filtering after you export.
Once your pattern runs
- The full regex library — every pattern worth running, organised by the job it does, with prompts for ChatGPT and Claude
- Google Search Console Data Is Not Accurate — why a clean segment of incomplete data is still incomplete data
- The Search Console resource guide — everything else
