Overview

Regex is a feature that provides the capability to create a campaign that includes or excludes users who visit specific pages on your website.

📘

Regex Explained

Regex is an abbreviation for the term regular expression which defines a search pattern for a string. The pattern can be a single character, multiple characters, or an expression with characters describing the pattern.

Following are some Regex examples:

  • "." matches any character.
  • "ABC" matches ABC.
  • "A|B" matches A or B.

Use Case

For example, if you have a travel booking site, you can create a campaign that targets users who are searching for flights between San Francisco and Los Angeles. When a user searches for flights from San Francisco (SFO) to Los Angeles (LAX) on your website, the URL follows this pattern: https://www.example.com/flights/SFO/LAX. Using the Regex below, you can identify users who visited that URL and include them in a campaign.

.*(SFO|LAX).*

Feature Guide

When creating a campaign in CleverTap that targets web users, you can use the Regex feature to define who receives the campaign based on pages the user did or did not visit.

900

If you want to include users who visited a page that matches the Regex, select the matches regex option. If you want to exclude those users, select the does not match regex option.

If there is only one page that needs to be matched or not matched for a campaign, then you can use the options contains or does not contain.

Examples

The following table shows more examples:

RegexNotes
.Matches any character.
example textMatches exactly. For example: "example text".
example\s+textMatches the word "example" followed by one or more whitespace characters followed by the word "text". For example: "example text".
A|BMatches A or B.

Regex Verification

You can use Regex101.com to build and test your Regex.