GTM Regex Generator
Generate GTM-compatible regex patterns from plain English
How It Works
Describe your match pattern
Enter the URL, path, or string pattern you want to match in GTM.
Choose pattern type
Select exact match, starts with, contains, or ends with.
Test and copy
Test the generated regex against sample strings and copy it for use in GTM triggers.
GTM Regex Generator
Generated regex for GTM:
Why Regex Is Essential in Google Tag Manager
Regular expressions — regex — are one of the most powerful tools in any GTM practitioner's toolkit. In GTM, regex enables you to write a single trigger condition that matches hundreds or thousands of URLs, rather than creating individual triggers for each page. A single regex pattern like /checkout/(cart|payment|confirmation) can replace three separate triggers, making your GTM container cleaner and more maintainable.
GTM Regex Patterns You Will Use Every Day
- Thank-you page match:
/thank-you|/order-confirmation|/success - Starts with path:
^/blog/— matches any URL path starting with /blog/ - Query string contains:
[?&]source=email— matches URLs with a specific UTM parameter - Exclude admin pages:
^(?!/admin/)— negative lookahead to exclude admin URLs - Match specific product categories:
/products/(shoes|bags|accessories)/
Testing Regex Before Deploying to GTM
Never deploy a regex trigger to GTM without testing it first. A regex that matches too broadly will cause tags to fire on unintended pages. Use this GTM regex generator to test your pattern against representative sample URLs from your site before copying it into GTM.