Free tool by MD Niamul

Free GTM & GA4 Regex Tester Test a Pattern the Way Google Tag Manager and GA4 Really Match It

Catch the Regex Mistake Before It Breaks a Trigger or a Report

Runs in your browser
GTM and GA4 match modes
Free Excel report

Type a pattern and your test values. This free GTM regex tester shows what matches in Google Tag Manager (partial match) and in GA4 (full match), highlights the matched part and the capture groups, and warns about anything RE2 does not support, such as lookahead. It also explains the pattern in plain English and includes a library of 24 ready regex patterns for tracking work.

24Ready-made patterns
4GTM and GA4 match modes
850+Projects delivered
600+Five-star reviews
MD Niamul, creator of the free gtm & ga4 regex tester
upworkTop Rated Plus
GTM + GA4 RegexFree Tester Tool
OfficialStape Partner

Everything the GTM & GA4 Regex Tester Does

GTM matches RegEx
Ignore Case Mode
GA4 Full Match
GA4 Partial Match
RE2 Warnings
Lookahead Check
Backreference Check
Named Groups
Capture Groups
Match Highlighting
Unescaped Dots
Missing Anchors
Empty | Options
Plain-English Explainer
Pattern Builder
Pattern Library
Copy Pattern
Excel Export
FREE GTM REGEX TESTER

Test Your Regex for GTM and GA4

Type a pattern, choose where you will use it and add test values. Results update as you type.

GTM & GA4 Regex TesterMatch modes · RE2 warnings · Capture groups · Explainer · Pattern library
Free · No login
GTM matches anywhere in the value. GA4 “matches regex” needs the whole value to match.

Everything is tested in your browser. Your pattern and test strings are not sent anywhere.

Results

Build a pattern from a list

Paste the values you want to match. Special characters such as dots and question marks are escaped for you. The pattern is written for the mode chosen above.

Pattern library for tracking work (24 ready patterns)

Click a pattern to load it with sample test strings. Domains and IDs are fictional examples: replace shop.example with your own domain.

Follows how GTM and GA4 matchFlags what RE2 does not supportExcel report to download
WHAT IT DOES

What Does the GTM Regex Tester Check?

The differences between GTM and GA4 that make a correct-looking pattern fail.

Match Modes

GTM matches anywhere in the value. GA4 “matches regex” needs the whole value. Test either one.

Highlighted Matches

Each test value is marked Match or No match, with the matched part highlighted.

Capture Groups

See what each pair of brackets captures, for RegEx Table variables and URL parts.

RE2 Warnings

Lookahead, lookbehind, backreferences, possessive quantifiers and atomic groups are flagged.

Common Mistakes

Unescaped dots and question marks, stray | signs, spaces and missing anchors.

Plain-English Explainer

The pattern is broken into parts with a short meaning for each one.

Pattern Builder

Paste a list of values and get an escaped pattern for equals, contains, starts with or ends with.

Pattern Library

Ready patterns for thank-you pages, downloads, IP ranges, click IDs, subdomains and more.

How Does the Regex Tester Work?

Three steps. Your pattern stays in your browser.

01

Enter a pattern

Type your own, build one from a list of values, or load one from the library.

02

Choose GTM or GA4

Pick the condition you will use, so the test follows the same matching rule.

03

Read the results

See which test values match, what each group captures, and any warning with its fix.

Why Test Regex for GTM and GA4 Separately?

A regular expression, or regex, is a pattern that describes text. In tracking work you use it to say “any thank-you page”, “these five domains” or “links that end in .pdf”. The same pattern can behave differently in Google Tag Manager and in Google Analytics 4. This GTM regex tester shows both.

How Google Tag Manager matches regex

  • matches RegEx is a partial match. The pattern /pro/ matches any value that contains /pro/. Add ^ and $ when you need an exact start or end.
  • matches RegEx (ignore case) does the same and treats capital and small letters as equal.
  • A web container runs in the visitor’s browser, so the pattern follows JavaScript regex rules.

How GA4 matches regex

  • matches regex is a full match. Google’s help page says that, without extra characters, the expression only returns exactly matching values. To match values that contain your text, write .*text.*.
  • Some GA4 screens also offer a partially matches regex condition, which matches anywhere in the value.
  • GA4 regex is case-sensitive by default and uses Google’s RE2 syntax.

What RE2 does not support

RE2 is the regex engine behind GA4, BigQuery and Looker Studio. It is built to be fast and safe, so it leaves out a few features that JavaScript has:

  • Lookahead and lookbehind, such as (?!internal).
  • Backreferences, such as \1.
  • Possessive quantifiers and atomic groups, which JavaScript does not support either.

A pattern with lookahead can work in a GTM trigger and then fail when you paste it into a GA4 filter. To exclude something in GA4, use a plain pattern with a “does not match regex” condition.

What this tool cannot check

The test runs in your browser’s JavaScript engine. It does not run RE2 itself: RE2 differences are flagged by a set of rules, so an unusual pattern could behave differently in GA4 without a warning here. The tool also cannot see the real values on your site, such as the exact Page Path or Click URL that GTM reads. Always confirm a pattern in GTM Preview mode, or in a GA4 report, before you rely on it.

Regex Cheat Sheet for Tracking

The characters you need most often in GTM triggers and GA4 filters.

SymbolMeaningExample
.Any single charactera.c matches abc and a-c
\.A real dotshop\.example
^Start of the value^/blog starts with /blog
$End of the value\.pdf$ ends with .pdf
|Orcart|checkout
( )Group, and capture what is inside^/(en|de)/
?The item before it is optional/pricing/?
* and +Zero or more, one or more.* is “anything”
[ ]One character from a set[0-9] is a digit
{2,4}Repeat 2 to 4 times[0-9]{5,10}
\dA digit^ORD-\d{6}$
\?A real question mark/search\?q=

Who Is This Regex Tester For?

GTM specialists

Test trigger conditions and RegEx Table patterns before you publish.

GA4 analysts

Check that a filter pattern survives the full-match rule and RE2.

Marketers

Load a ready pattern and swap in your own pages or domains.

Developers

See which JavaScript regex features will not carry over to GA4 or BigQuery.

MORE FREE TOOLS

More Free Marketing Tools by MD Niamul

33 free tools for tracking, analytics, advertising and SEO. No login needed.

Free Google Ads Audit Tool

Scan a landing page and keywords for Quality Score, ad copy, CTR and tracking issues.

Open the Google Ads audit →

Free GA4 BigQuery SQL Generator

Ready-to-run SQL for the GA4 BigQuery export: revenue by source, funnels, items and more.

Open the SQL generator →

Free Google Ads Copy Generator

Write responsive search ad headlines and descriptions with live character counts.

Open the ad copy generator →

Free Measurement Plan Generator

Get a tracking plan for your business type: events, parameters and platform mapping in Excel.

Open the plan generator →

Trusted by 600+ Brands & Agencies

MYLENE
HOVER BOARDS
GT SOLI
CAMBRIDGE
BIENEN CORB 24
ZULU SHACK CREATIVE
ADPSY LLC
HIGH PERFORMANCE MEDIA
ADS PERFORMANCE
LEGESI
TESTIMONIAL

Analytics & Conversion Tracking Client Testimonials

Hear from our clients. Loved by 600+ businesses worldwide.

Madison Jonas, client of MD Niamul
Madison JonasGoogle Ads clientLinkedIn recommendation
★★★★★

“I had an excellent experience working with MD on my Google Ads account. Everything was set up perfectly and worked smoothly without any issues or troubleshooting needed. His expertise and attention to detail made the whole process effortless.”

Mehboob Khan, client of MD Niamul
Mehboob KhanGoogle Analytics projectsLinkedIn recommendation
★★★★★

“I worked with Niamul on multiple Google Analytics projects and was impressed by his expertise and precision. He has a strong grasp of tracking, reporting, and optimization, always ensuring accurate insights. He is proactive, reliable, and easy to collaborate with.”

Jacco Bouw, client of MD Niamul
Jacco BouwShopify, GA4 & Google Ads trackingLinkedIn recommendation
★★★★★

“MD Niamul is extremely skilled. He fixed my Shopify, Google Analytics, and Google Ads conversion tracking perfectly. Everything works exactly as it should now, and he even added an extra data layer, which was very helpful. Outstanding service, fast delivery, and highly recommended.”

Ryan S Kemp, client of MD Niamul
Ryan S KempCMO, Co-Founder, Zulu Shack CreativeLinkedIn recommendation
★★★★★

“Reliable, knowledgeable, and truly trustworthy. I’ve been working with Niamul for over a year, and he consistently delivers exceptional results across all analytics tasks. His expertise, communication, and commitment make him my go-to specialist for tracking, measurement, and data accuracy.”

Casper Klein, client of MD Niamul
Casper KleinMeta Pixel & server-side trackingLinkedIn recommendation
★★★★★

“MD N delivered flawless Meta Pixel, CAPI, and server-side tracking. He understood our goals quickly, explained everything clearly, and ensured full transparency. Communication was smooth, updates were consistent, and the results improved our data accuracy and ad performance.”

600+

Five-star reviews from businesses and agencies in the USA, Canada, UK and Australia.

Read All Reviews

Video Testimonials: Hear It From Our Clients

FAQ

Frequently Asked Questions About the Free GTM & GA4 Regex Tester

Is the GTM regex tester free?

Yes. It runs in your browser with no login. Your pattern and test strings are not sent anywhere.

Does “matches RegEx” in GTM match the whole value or part of it?

Part of it. A GTM regex condition is true when the pattern is found anywhere in the value. Add ^ at the start and $ at the end when the whole value has to match.

Why does my regex work in GTM but not in GA4?

There are two usual reasons. GA4 “matches regex” needs the whole value to match, so you may need .* around your text. And GA4 uses RE2, which does not support lookahead, lookbehind or backreferences.

What is RE2?

RE2 is Google’s regular expression engine. GA4, BigQuery and Looker Studio use it. It is fast and predictable, but it leaves out lookaround and backreferences.

How do I make a regex ignore case?

In GTM choose the “matches RegEx (ignore case)” condition. In GA4 add (?i) at the start of the pattern. GA4 conditions are case-sensitive by default.

Why do I need a backslash before a dot?

A dot on its own means “any character”, so shop.example would also match shopXexample. Writing \. matches a real dot only.

What is a capture group?

A pair of brackets that remembers the text it matched. In a GTM RegEx Table variable you can reuse that text in the output, for example to pull a product ID out of a URL.

Does this tool run the real RE2 engine?

No. It runs your pattern in your browser’s JavaScript engine and uses rules to flag the features RE2 does not support. Confirm the result in GA4 before you rely on it.

Can I use lookahead in a GTM trigger?

Yes, GTM runs JavaScript regex, which supports lookahead. Lookbehind fails in older Safari versions, and neither will work if you later reuse the pattern in GA4 or BigQuery.

A Pattern That Matches Is Only the First Step

I am MD Niamul, a conversion tracking and web analytics specialist and an official Stape partner. I build and audit Google Tag Manager containers, triggers and GA4 setups, and test every condition so your tags fire when they should and your reports are accurate.