G Suite is now Google Workspace: everything your business needs to get work done.

Regex and CSS selector operators

You can use regular expressions (regex) and cascading style sheet (CSS) selectors as operators wherever trigger filters are used. When a regular expression or CSS selector is set as the operator for a trigger, you can specify that the trigger matches the rule.


The "matches regex" option allows you to implement regular expressions in Google Tag Manager for matching text patterns. Regex is useful for expressing more complex types of rules such as "fire the tag when the URL starts with A and ends in B or C."

For example, this regular expression when applied to a URL variable will match all pages with the string "pro" in the URL path, including "products", "promotions, "professionals", and "processes":


CSS selectors

The CSS selector may be used to target specific HTML elements. For instance, this selector applied to a Click Element variable will match a click for any element with a class attribute value of "purchase" that is a descendant of an element with an ID attribute value of "promo":

#promo .purchase

Related resources

Was this helpful?
How can we improve it?
Clear search
Close search
Google apps
Main menu
Search Help Center