Understanding "Contains" and "Matches" in Segment Builder Filters
In our Segment Builder, you can leverage the "Contains" and "Matches" filters to fine-tune your customer and sales data analysis. Below is a guide on how each filter functions, tailored to the needs of a Shopify analytics app.
"Contains" Filter
This filter performs a basic substring match within a specified field.
- Example: If you use "organic" in the "Contains" filter for product tags, it will match any product tagged with phrases like "organic cotton" or "100% organic."
"Matches" Filter
The "Matches" filter is more sophisticated, employing regex (regular expressions) based on the RE2 syntax for intricate pattern matching.
- Example: To find email addresses from a specific domain like 'hotmail.com', the regex would be
.*@hotmail\.com$
.
Practical Regex Examples for Shopify Analytics
Here are relevant regex examples tailored for Shopify store analysis:
.*@hotmail\.com$
- Matches all email addresses ending with @hotmail.com.^vendorname.*
- Matches vendor names starting with 'vendorname'.^(Sale|Discount).*
- Matches coupon codes beginning with 'Sale' or 'Discount'..*202[0-9]$
- Matches strings (like campaign names) ending with a year between 2020 and 2025.^\d{5,10}$
- Matches SKU numbers that are 5 to 10 digits long.^#\w{6}$
- Matches Product Numbers that start with '#' followed by six alphanumeric characters.