Advertisement

GA4 Event Filter Regex — Patterns That Actually Work (and a Free Generator)

Building a GA4 event filter regex for several event names, a prefix convention or an event parameter? This page explains exactly how GA4 evaluates your pattern, then gives you copy-paste ga4 event name regex recipes — each one testable in the free regex tester before you paste it into an exploration, key event or audience rule.

Two rules first: GA4 regex is a full match — page_view matches only page_view, never page_view_v2 — and GA4 runs RE2, so lookahead (?=…) and backreferences \1 fail silently. Full-match is actually good news for event filters: alternation alone is precise enough, no anchors needed.

How GA4 evaluates an event filter regex

Apply regex to the event_name dimension in explorations, custom reports, audiences or key-event conditions. GA4 checks whether your pattern matches the entire event name:

Event name regex patterns

Click any row to load the pattern plus a sample event list into the tester.

Multiple events (alternation)

You wantRegex
The core ecommerce funnel(view_item|add_to_cart|begin_checkout|add_payment_info|purchase)Try in tester →
Scroll + video engagement(scroll|video_start|video_progress|video_complete)Try in tester →
File downloads & shares(download|file_download|share)Try in tester →
Search events(search|search_results|view_search_results)Try in tester →

Conventions: prefixes, suffixes, contains

You wantRegex
All custom events under myapp_myapp_.*Try in tester →
Any event ending in _click.*_clickTry in tester →
Any event ending in _view.*_viewTry in tester →
Events containing "checkout".*checkout.*Try in tester →
All begin_* eventsbegin_.*Try in tester →
Exactly one event namepage_viewTry in tester →

Note the last row: page_view matches only page_view — page_view_v2 stays out. That is full-match working in your favor.

The "generator" recipes (build any event filter in 10 seconds)

Every event filter regex is one of four shapes. Pick the shape, swap in your text:

  1. List of exact names → (name1|name2|name3) — paste your list between the pipes.
  2. Prefix convention → prefix_.* — e.g. all crm_ events: crm_.*.
  3. Suffix convention → .*_suffix — e.g. every _click.
  4. Contains a word → .*word.* — e.g. anything with "checkout".

Then validate the result against your real event list in the tester before touching GA4 — one wrong pipe or forgotten .* is exactly what produces empty reports.

Regex on event parameter values

Regex also works on dimensions that carry parameter values (built-in ones like page_location, or custom dimensions you register):

You wantRegex
Currency is USD or EUR(USD|EUR)Try in tester →
Item name contains "Pro".*Pro.*Try in tester →
Any URL with a query string.*\?.*Try in tester →
Traffic tagged with utm_medium.*[?&]utm_medium=.*Try in tester →

Remember: page_location holds the full URL; parameter dimensions hold the value only (e.g. email, not utm_medium=email — drop the parameter name when filtering the dimension itself).

Why event filters return no data

Validate your event regex against a real event list
Paste every event name from your GA4 property, one per line, and watch each match highlight. Free & private.
Open the GA4 regex tester →

FAQ

How do I filter multiple events in GA4 with regex?

Alternation: (purchase|begin_checkout|add_to_cart). Because GA4 matches the full string, each name matches exactly — no anchors required and nothing extra can slip in.

Why does my event regex not match in GA4?

Check three things: full-match (does your pattern cover the whole name?), case (GA4 is case-sensitive), and engine (RE2 rejects lookahead/backreferences silently).

Can regex filter event parameter values?

Yes — apply it to the dimension carrying the value (a custom dimension or built-in one like page_location), not to event_name.

Does GA4 event regex support lookahead?

No. GA4 uses RE2. For "match X but not Y", add a second exclude filter in GA4 rather than an assertion.

More shapes and examples in the GA4 regex cheat sheet, and page-specific patterns in the GA4 page path regex guide.