Free Tool

GTM Regex Tester

Test regular expressions against multiple strings. Use GTM-specific presets for URL matching, query params, referrer filtering, and page paths.

0 lines

GTM Regex Patterns Reference

URL Path Matching
Match specific URL paths in GTM triggers. Example: ^\/products\/([\w-]+)\/?$ matches /products/shoes and captures the product slug.
Query Parameter Extraction
Extract query string values. Example: [?&]utm_source=([^&#]+) captures the utm_source value from any URL.
Referrer Filtering
Filter traffic by referrer domain. Example: ^https?:\/\/(www\.)?(google|bing|yahoo)\.com matches major search engines.
Page Path Contains
Match pages containing a keyword. Example: \/(blog|news|articles)\/.+ matches any content page path.
GTM Regex Table vs Regex Match
In GTM, Regex Match trigger conditions use full-match semantics (anchored). Use .*pattern.* to match anywhere, or ^pattern$ for exact matches. Regex Tables in variables use capture groups to return values.
Case Sensitivity in GTM
GTM regex matching is case sensitive by default. Use the (?i) inline flag or check the case-insensitive option in your trigger conditions.

Skip regex headaches in GTM

GTM Event Helper auto-generates triggers, tags, and variables from any element you click. No regex writing, no manual configuration.

Install GTM Event Helper — Free