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

# 正規表現の説明

正規表現（Regex、または Regular Expression）は、一般的なケースでテキストを一致させるために使えるコードで、プロモコードの一致判定に便利です。Regex は大文字・小文字を区別するため、プロモコードの表記に合うように正規表現を設定してください。

* Regex とプロモコードには、主に 2 つのロジックがあります—`〜で始まる` および `〜で終わる`.
* この例では、プロモコードのベースは `SUMMER`.

{% tabs %}
{% tab title="先頭一致" %}
パートナーにさまざまな夏のプロモコードを発行しました、 `SUMMER20OFF`, `SUMMER10`、および `SUMMER25`。これらすべてを一致させてパートナーに適用するには、どうすればよいでしょうか？ ここでは `〜で始まる` のロジックを使います。ベースのプロモコードの末尾にピリオドとアスタリスクを追加するだけです。

正規表現は正確には `^(SUMMER).*`

これにより、〜で始まるすべてのプロモコードが自動的に一致し、 `SUMMER` かつ、他の任意の文字で終わるものも一致します。〜で始 `SUMMER` まらないコードは一致しません。
{% endtab %}

{% tab title="末尾一致" %}
パートナーにさまざまな夏のプロモコードを発行しました、 `20OFFSUMMER`, `10SUMMER`、および `25SUMMER` プロモコードが常に〜で終わる場合 `SUMMER`。これらを一致させるにはどうすればよいでしょうか？ ここでは `〜で終わる` のロジックを使います。ベースのプロモコードの先頭にピリオドとアスタリスクを追加し、文字列のアンカーを指定するために $ を追加するだけです。

正規表現は正確には `^.*(SUMMER)$`

これにより、他の文字で始まり、〜で終わるすべてのプロモコードが自動的に一致します。 `SUMMER`。〜で終わらないコードは一致しません。 `SUMMER` まらないコードは一致しません。
{% endtab %}
{% endtabs %}

より複雑な式については、CSM または [サポートにお問い合わせください](https://app.impact.com/support/portal.ihtml?createTicket=true\&accountType=ADVERTISER) までご相談ください。

{% hint style="info" %}
**注意：** Regex の大文字・小文字の区別は次を追加することで解除できます `(?i)` の後に `^` 正規表現に
{% endhint %}

#### 例

```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/ja/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.
