> 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/es/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-explained.md).

# Regex explicada

Regex (o expresión regular) es un código que puedes usar para hacer coincidir texto en un caso general y es útil al coincidir códigos promocionales. Regex distingue entre mayúsculas y minúsculas, así que asegúrate de configurar tu regex de forma que coincida con tus códigos promocionales.

* Hay dos casos lógicos principales para regex y códigos promocionales—`empieza con` y `termina con`.
* Para este ejemplo, la base de nuestro código promocional es `SUMMER`.

{% tabs %}
{% tab title="Empieza con" %}
Has emitido un rango de códigos promocionales de verano a socios, `SUMMER20OFF`, `SUMMER10`, y `SUMMER25`. Queremos hacer que todos coincidan para acreditar a nuestros socios, ¿cómo lo hacemos? Usaríamos la `empieza con` lógica. Simplemente añade un punto y un asterisco al final de tu código promocional base.

La regex debe ser exactamente `^(SUMMER).*`

Esto hará coincidir automáticamente cualquier código promocional que empiece con `SUMMER` y termine con cualquier otro carácter. Cualquier código que no empiece con `SUMMER` no coincidirá.
{% endtab %}

{% tab title="Termina con" %}
Has emitido un rango de códigos promocionales de verano a socios, `20OFFSUMMER`, `10SUMMER`, y `25SUMMER` donde el código promocional siempre termina en `SUMMER`. ¿Cómo hacemos que coincidan? Usaríamos la `termina con` lógica. Simplemente añade un punto y un asterisco al principio de tu código promocional base y añade un $ para especificar el ancla de tu cadena.

La regex debe ser exactamente `^.*(SUMMER)$`

Esto hará coincidir automáticamente cualquier código promocional que empiece con otros caracteres y termine con `SUMMER`. Cualquier código que no termine con `SUMMER` no coincidirá.
{% endtab %}
{% endtabs %}

Para expresiones más complicadas, ponte en contacto con tu CSM o [contacte con soporte](https://app.impact.com/support/portal.ihtml?createTicket=true\&accountType=ADVERTISER) para obtener ayuda.

{% hint style="info" %}
**Nota:** Puedes eliminar la sensibilidad a mayúsculas y minúsculas de regex añadiendo `(?i)` después de `^` en tu regex.
{% endhint %}

#### Ejemplo

```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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
