GA4 Regex Tester with RE2 Checks

Test a regular expression against your own values the way GA4 reads it, with warnings for syntax that GA4 will reject.

How to use

What it checks and how it works

Google's regex page says GA4 regex is a full match by default and case sensitive, and that a partial match needs metacharacters such as .*; its report-filter page says regular expressions are limited to 250 characters. The tester follows those rules: in whole-value mode it anchors your pattern at both ends, and it shows the pattern length against 250. GA4 evaluates patterns with RE2, which has no lookahead, lookbehind, backreferences or possessive quantifiers. This tester runs your pattern with your browser's JavaScript engine, which accepts some of those. So it scans the pattern for the RE2 differences it can detect and warns about them, and notes RE2-only syntax such as (?i) flags and POSIX classes that it cannot fully run. It cannot prove that a pattern works in GA4, so confirm the final version in GA4.

Why does my pattern match in a tester but not in GA4?

Often because it uses a lookahead, lookbehind or backreference that RE2 does not support, or because GA4 matches the whole value and the pattern matched only part of it. This tester warns about both.

Is GA4 regex case sensitive?

By default yes, according to Google's regex page. The tester has an ignore-case switch to help you compare, but GA4 report filters do not ignore case, so write the pattern to match the capitalisation in your data.

What is the 250-character limit?

Google's report-filter page says regular expressions are limited to 250 characters. If your pattern is longer, split the values across two filters or two channels.

Sources

Related tools

Privacy

Runs in your browser; nothing is uploaded. The interactive tool needs JavaScript.