Regex Generator
GA4 / GTM regex utilities.
Build The Pattern
Paste one value per line. Pick the match mode. We produce a safe, escaped regex ready to drop into GA4, Google Ads, GTM, or Looker Studio.
3 values detected. Special characters are escaped for you.
Matches /path and everything under /path/*. Perfect for GA4 page_path.
(?i)^(?:/thank-you|/order-confirmation|/checkout/success)(?:/.*)?$
Matches the listed paths and any nested path under them. Ideal for GA4 page_path filters where you want /blog and /blog/anything.
- /thank-youMATCH
- /thank-you/upsellMATCH
- /blog/how-toNO MATCH
- /checkout/success?ref=metaNO MATCH
One Regex Away From Clean Reporting.
Half of every messy GA4 report comes from a filter that almost works. A missing anchor, an unescaped dot, a greedy wildcard, and the numbers drift 10 to 40 percent every week. Marketing then reports on the drift, not the business.
This builder writes the pattern for you, escapes the dangerous characters, and lets you paste sample URLs to prove the match before you ship it into GA4 or GTM. Copy once, trust forever.
- Anchor Every Exact Match. Use ^ and $. Without them, /thank-you also matches /thank-you-not.
- Escape The Dot. A raw dot matches any character. Use \\. inside domains and file extensions.
- Prefer Non Capturing Groups. (?:a|b) not (a|b). GA4 sometimes trips on captured groups.
- Test Before You Ship. Paste live URLs in the tester. If one wrong line matches, the report will lie.
Nine of ten reporting bugs we audit trace back to a filter that was never tested.
Page Path Filters
Use the Path And Subpaths mode. GA4 stores page_path without hostname, so anchor at ^ and finish with (?:/.*)?$ to include nested URLs.
URL Conversion Rules
Google Ads matches full URLs including domain. Use Hostname Or Subdomain mode so the pattern survives www, staging, and mobile variants.
Trigger Matches RegEx
Set the trigger to Matches RegEx, not Contains. Contains ignores anchors and quietly fires on lookalikes like /thank-you-preview.
Filters That Quietly Break Your Reports
- Unescaped Dots. trakkify.in also matches trakkifyxin. Always write trakkify\\.in.
- Missing Anchors. /blog matches /company/blog/x. Use ^/blog.
- Greedy .* Everywhere. Slow to evaluate and prone to false positives.
- Case Sensitive Filters. Real URLs mix cases. Add the (?i) flag or the i modifier.
- Testing Only Happy URLs. Always paste the near miss URL too. If it also matches, the filter is wrong.
- GA4 Key Event. Admin, Events, Create Event, condition where page_path matches regex.
- GA4 Audience. Admin, Audiences, condition where page_path matches regex, membership 30 days.
- Google Ads Conversion. Conversion action, URL rule, matches regex.
- GTM Trigger. Trigger type Page View, filter Page Path matches regex.
- Looker Studio. Filter, Include, Regex Match on page_location.
