Regular expression (regex)
A regular expression (regex) is a sequence of characters that specifies a search pattern for a given string. The search pattern can include numbers, letters, space and special characters. In this article we will cover ways in which your organization can leverage regex in the Didomi console and a brief overview of some common syntax to use in your regex.
Didomi regex use cases
Regex can be used in the following areas of the Didomi console:
Analytics filters
For analytics dashboards that have Domain(s)/App(s) (Exclude), Domain(s)/App(s) (Include), and Notice name filters, your organization can use regex to filter metrics for specific domains and/or apps. The match is case insensitive.

A common regex to use with analytics filters is the pipe character "|" to express disjunction (matches "x" OR "y").
Compliance report URL filter
The URL filter is an advanced setting for compliance reports that enable your organization to direct the Didomi bot to only scrape URLs that contain a specific string. Enable the The URL filter is a regular expression toggle to use regex in the URL filter,

Persist tracker settings by pattern
There are specific use-cases where you may want to persist a single set of exemptions and purposes across a group of trackers that follow a particular pattern. Utilizing regular expression (regex), your organization can provide the pattern for a single tracker and Didomi will apply the tracker's settings to any tracker found in a compliance report that matches the configured pattern. Click here to learn more about persisting tracker settings by a regex pattern.

Regex common syntax
The table below offers some common regex syntax that your organization can utilize in your expressions. Didomi strongly encourages you to test your regex before applying them to your filters with free regex tools such as regexr.com.
.
Placeholder the matches any character (including spaces)
a.c
abc baec
abdc (two characters instead of one between a and c
.*
matches all characters
test.*
testtest test-version6 domain-text
domain-tes (missing character)
^
matches at the beginning of the string
^debug
debug.domain.com
domain.debug (does not start with debug)
$
matches at the end of the string
.com$
domain.com support.domain.com
domain.com.co (does not end with .com)
\/
escapes / character
\/page2\/
/page2/
/page-v2/
[abc]
any of a, b, c
test-[yv]
test-y test-v
test-[yv] (identified as regex pattern and not characters)
ab|cd
matches ab or cd
domain|support
dev.domain.com subdomain.com support.fr
mainpg (neither word is in string)
^(ab|cd)
matches beginning with ab or cd
^(debug|support)
debug.domain.com support.domain.com
domain.debug.com (debug is not at the start of string)
(ab|cd)$
matches end with ab or cd
(.fr|.co.uk)$
domain.fr sub.domain.fr domain.co.uk
.fr.domain.com (string does end in .fr)
Last updated