All Collections
Data Transformation
Custom Dimensions
How do I use regex to identify dimension values that contain two specific sets of characters?
How do I use regex to identify dimension values that contain two specific sets of characters?

Learn how to match or capture a dimension's values only if they contain two different strings at the same time.

Simon Kalicinski avatar
Written by Simon Kalicinski
Updated over a week ago

If you want to use regex in a dimension rule or a regex based filter in one Funnel's export functions, you can use an expression that requires two different combinations of characters to be present in the dimension values you will be screening. In this example, we have identified that we only want to export certain Campaigns in our GA Upload export and need a filter to be applied to our export rules configuration. To get this right, we need only the Campaigns that contain both of the following:

  • ABC

  • 123

If we edit our configuration for our GA Upload export, we can manage and add rules to individual data sources in order to only export data for certain Campaigns. When we find the data source that we want to add a rule for, we hit Edit on the far right side of that source. 

  1. If you need to add a new rule to an existing one, hit + Export rule first.

  2. Next, select Campaign (or any other dimension this rule should based on) in the first dropdown.

  3. In the next dropdown, select matches regex.

  4. In the text input field to the right of the two first dropdown lists, add this regex: ^(?=.*\bABC\b)(?=.*\b123\b).*$ 

  5. Add any remaining specifications in the remaining fields as needed.

Now, this data source will only export data for Campaigns that contain "ABC" and "123" somewhere in its dimension values. For example, the Campaign "ABC - It's easy as 123" will be exported.

Did this answer your question?