> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/it/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-explained.md).

# Spiegazione delle regex

Regex (o espressione regolare) è un codice che puoi usare per confrontare il testo in un caso generale ed è utile quando si abbinano codici promozionali. Regex è sensibile alle maiuscole/minuscole, quindi assicurati di impostare la tua regex nella combinazione di maiuscole/minuscole che corrisponde ai tuoi codici promozionali.

* Esistono tre principali casi logici per regex e codici promozionali: `inizia con`, `finisce con`, e `contiene`.
* Per questo esempio, la base del nostro codice promozionale è `SUMMER`.

{% tabs %}
{% tab title="Inizia con" %}
Hai emesso una serie di codici promozionali estivi ai partner, `SUMMER20OFF`, `SUMMER10`, e `SUMMER25`. Vogliamo farli corrispondere tutti per accreditare i nostri partner, come facciamo? Useremmo la `inizia con` logica. Basta aggiungere un punto e un asterisco alla fine del tuo codice promozionale di base.

La regex dovrebbe essere esattamente `^(SUMMER).*`

Questo abbinerà automaticamente qualsiasi codice promozionale che inizi con `SUMMER` e termini con altri caratteri. Eventuali codici che non iniziano con `SUMMER` non verranno abbinati.
{% endtab %}

{% tab title="Finisce con" %}
Hai emesso una serie di codici promozionali estivi ai partner, `20OFFSUMMER`, `10SUMMER`, e `25SUMMER` dove il codice promozionale termina sempre con `SUMMER`. Come facciamo ad abbinarli? Useremmo la `finisce con` logica. Basta aggiungere un punto e un asterisco all'inizio del tuo codice promozionale di base e aggiungere un $ per specificare l'ancora della tua stringa.

La regex dovrebbe essere esattamente `^.*(SUMMER)$`

Questo abbinerà automaticamente qualsiasi codice promozionale che inizi con altri caratteri e finisca con `SUMMER`. Eventuali codici che non finiscono con `SUMMER` non verranno abbinati.
{% endtab %}

{% tab title="Contiene" %}
Hai emesso una serie di codici promozionali estivi ai partner, `20SUMMER`, `SUMMER20OFF`, e `EXTRASUMMER10`, dove `SUMMER` compare da qualche parte nel codice. Useremmo la `contiene` logica. Aggiungi `.*` prima e dopo il tuo codice promozionale di base e racchiudi l'espressione tra gli ancoraggi ^ e $.

La regex dovrebbe essere esattamente `^.*(SUMMER).*$`

Questa regex corrisponde a un codice promozionale contenente `SUMMER` in qualsiasi punto del codice. Eventuali codici che non contengono `SUMMER` non verranno abbinati.
{% endtab %}
{% endtabs %}

Per espressioni più complesse, contatta il tuo CSM oppure [contatta il supporto](https://app.impact.com/support/portal.ihtml?createTicket=true\&accountType=ADVERTISER) per assistenza.

{% hint style="success" %}
**Nota:** Puoi rimuovere la sensibilità alle maiuscole/minuscole della regex aggiungendo `(?i)` dopo `^` nella tua regex.
{% endhint %}

## Esempio

```programlisting
^(?i)(SUMMER).*
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.impact.com/brand/it/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-explained.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
