> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.poool.fr/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to use RegEx to target specific URLs

With Engage, you can use the **“on some pages”** display/hide condition to control where your elements appear based on URLs.

This condition works using the **“contains”** operator.
![](https://storage.crisp.chat/users/helpdesk/website/-/5/f/5/0/5f50f52b22503800/url-condition_1ddozl.png)


In most cases, using a standard URL will be sufficient. However, depending on your URL structure and site architecture, entering a simple URL may unintentionally target pages you don’t want.

For example, let’s say you only want to target your homepage:`https://www.example.com`
If you enter this URL in the display condition: 

![](https://storage.crisp.chat/users/helpdesk/website/-/5/f/5/0/5f50f52b22503800/url-condition-example_ge03jk.png)


You will indeed target the homepage—but also any page whose URL contains `example.com`, which is not the intended behavior.
That’s where RegEx (and its wonderful world) comes in!


# What does RegEx mean?

RegEx (short for **Regular Expression**) is a set of rules that defines which sequences of characters should match in a search.
In other words, it’s a way to describe a pattern in text so it can be automatically identified.
For page targeting, this means matching only the URLs that follow a specific pattern.


## **Basic RegEx characters**
To build a RegEx, you use special characters to define what you’re looking for. Here are some basics:
* `a` → matches the letter “a”
* `.` → matches any character
* `\d` → matches a digit (0–9)
* `\w` → matches a letter or digit
* `*` → “0 or more times”
* `+` → “1 or more times”


# A RegEx example

Let’s go back to our example.

We want to target only the homepage:`https://www.example.com`

The corresponding RegEx would be:
```
^https://www\.example\.com$
```
### Explanation:
* `^` → start of the string
* `https://www.example.com` → exact URL
* `.` → escapes the dot



## **In the Dashboard**
With this RegEx, the element will only be displayed if the URL is exactly:
![](https://storage.crisp.chat/users/helpdesk/website/-/5/f/5/0/5f50f52b22503800/url-condition-example-regex_1ms3qz8.png)

It will not display if there are any characters before or after (such as tracking parameters).


## **Including tracking parameters**
If you want to target the homepage **including optional tracking parameters**, use:
```
^https://www\.example\.com(\?.*)?$
```
### Explanation:
* `^` → start of the string
* `https://www.example.com` → exact domain
* `(?.*)?` → optional part:
    * `?` → the `?` used in URL parameters (escaped)
    * `.*` → any characters after
    * `?` (outside) → makes the whole group optional


## **Testing your RegEx**
When creating your regular expressions, you can test them to see which URLs will match.
You can use online tools such as:
* [https://regex101.com](https://regex101.com)
* [https://regexr.com](https://regexr.com)


|| Tip : to save time, you can also use LLMs to help generate your regular expressions.


## **Need help?**
If you have any questions, feel free to reach out to the team!