This article will help you to:

  • Understand what a regex is
  • Use regex in a Condition
  • Use regex in a report

Definition

A regex, or regular expression, is a sequence of characters that designates a more or less restrictive part of your data. A regex describes a pattern to search for, such as a URL address, phone number or date.

For example, to search for all IP addresses between 198.51.100.1 and 198.51.100.25 the regex 198\.51.100\d* allows you to do this, instead of having to create 25 conditions.

More resources

If you want to learn more about regex and learn how to write your own regex, you can read the article on regex basics.


How to use regex in Reeport

The regex can be used in two ways in Reeport.

Creating a Condition for a Data Source

For example, the following regex creates a Google Analytics filter on Channel Grouping that contains "Search" or "search", such as "Paid Search", Organic Search" or "Metasearch".

Changing the display one dimension

When you select a Widget, in the Dimension section of the Data tab, the Formatting regex function allows you to find the dimension values that match a regex and to modify their content by the one of the groups captured in the regex (or all the content of the regex if necessary).

For example, the regex ^SEA_(?:GN|BR|other)_(.+)_.*$ only keeps the third part of the campaign name and hides the rest.

Note: however the Formatting regex option will only change the visual but will not allow you to re-aggregate the data in your widgets. You have to do it beforehand.

Other examples include :

  • Remove the first n characters with .{n}(.*)
  • Hide the "SEA_" strings with (.*)SEA_(.*)
  • Hide the above "Facebook" with .*(Facebook.*)

Did this answer your question?