> 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-inside-the-parentheses.md).

# かっこ内の正規表現

[正規表現](/brand/ja/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-explained.md) （または正規表現）は、アップロードした商品SKU、カテゴリ、またはプロモコードの文字列の一部を、コンバージョンとともにimpact.comに渡される値に一致させたいときに使えるコードの一種です。impact.comのMatch Expressionツールを使って、通常とは異なる支払いを行いたい商品SKU、カテゴリ、またはプロモコードを特定できます。

#### かっこ内

正規表現の一部をかっこの中に入れることで、その部分をまとめてグループ化できます。その後、Match Expressionツールは、角かっこの間に置いた値を抽出し、提供した対応する例外リスト項目の中から一致を見つけることができます。例外リストに追加する項目は、かっこの間の正規表現と完全に一致している必要があります。そうすることで、正規表現が [かっこの外側では](/brand/ja/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-outside-the-parentheses.md) リスト全体に適用できます。

#### シナリオ例

あなたのブランド、 *ACME Smile*は、顧客がいずれかの歯科製品を購入した際に、パートナーに5%を支払いたいと考えています。 *ACME Smile* ブランドでは製品を継続的に削除したり追加したりしているため、すべての歯科製品のSKUを網羅した一覧はありません。ただし、すべての歯科製品SKUは TOOTH、SMILE、または SHINE のいずれかで始まることは分かっています（例： `SHINE98763`, `SMILE987abc`, `TOOTH65abc64`).

すべての歯科製品SKUは TOOTH、SMILE、または SHINE で始まるため、一般的な歯科製品SKU用の正規表現を設定し、以下のセクションで示すように、不完全なSKU例外リスト内の一致を見つけるために Match Expression ツールを使用できます。

{% stepper %}
{% step %}

### 手順1: SKUリストを作成する

1. 上部ナビゲーションバーから、次を選択します ![](https://1458456015-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2F210dEQa93qyQgoJDkieL%2FUser%20profile.svg?alt=media\&token=f84c5b17-fae4-4a30-990a-9de5e57a150b) **\[ユーザープロフィール] → 設定**.
2. 右側の、 *例外リスト* セクションで、 [**SKU**](https://app.impact.com/secure/advertiser/campaign/itemlist/view-skuitemlist-flow.ihtml).
3. 選択してください **新しいSKUリストを追加**.
4. 〜を入力してください **リスト名**.
5. 次の **イベントタイプ** このSKUリストに関連付けたい項目を追加します。
   {% endstep %}

{% step %}

### 手順2: 正規表現を設定する

1. 選択してください **詳細設定を表示** そして、正規表現を **一致式** 欄に含めてください。
   * かっこ内には、一致させたい値だけを追加します：
     * 歯科製品SKUがこれらで始まると分かっている3つの文字列を、正規表現の文字で区切って追加します `|` これは OR を意味します。
   * かっこの外側には、一致条件を絞り込むのに役立つ任意の正規表現を追加します：
     * 正規表現の文字を追加します `^` 開始かっこの前に置いて行頭の位置を示し、前に文字がないことを保証します。
     * 正規表現の文字を追加します `.` 終了かっこの後に置いて、改行以外の後続文字（例：数字、文字、ハイフン）に一致させます。
     * 正規表現の文字を追加します `*` ピリオドの後に置いて、任意の数の一致（つまり、0件から無制限まで）を探します。
   * 最終的な式は `^(TOOTH|SMILE|SHINE).*`.
2. 選択してください **保存して項目を追加**.<br>

<div data-with-frame="true"><figure><img src="https://1458456015-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FWFAYx47NL9zXEA7EqkOt%2Fimage.png?alt=media&amp;token=ff38cad6-a0c1-4c00-b39d-36025dd0d053" alt="" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### 手順3: 例外リスト項目を追加する

1. 一致させたい値は、次の2つの方法のいずれかで一覧表示します：
   * **項目を手動で追加** TOOTH、SMILE、SHINE を入力して *SKU* 項目。<br>

     <div data-with-frame="true"><figure><img src="https://1458456015-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FoH6QfzDRJSsLdiFFuhiG%2FUntitled%20design%20(29).png?alt=media&amp;token=ecf9885b-292b-4651-9b56-df904665a10e" alt="" width="375"><figcaption></figcaption></figure></div>
   * または、 **CSVまたはExcelファイルをアップロード** 「TOOTH」「SMILE」「SHINE」を下に一覧表示して *SKU* 列を使用します。

     * 参照 [SKU例外リストを作成](/brand/ja/what-would-you-like-to-learn-about/account-administration/program-settings/exception-lists/create-sku-exception-lists.md) を参照してください。

     <div data-with-frame="true"><figure><img src="https://1458456015-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FqngJxT1772eJGcigeZMu%2FUntitled%20design%20(30).png?alt=media&amp;token=c030c1ca-d821-43a8-b304-558c6e47ab7d" alt="" width="374"><figcaption></figcaption></figure></div>
2. 選択してください **保存**.
   * 新しいSKUリストは *SKUリスト* 画面。
     {% endstep %}
     {% endstepper %}

#### 次は？

正規表現の Match Expression を設定し、3つのSKUリスト項目を追加したので、すべての *ACME Smile*の今後の歯科製品（それらのSKUも TOOTH、SMILE、または SHINE で始まると仮定した場合）は、例外リストの一部として一致します。正規表現に一致する受信コンバージョンは、例外リストの一部としてフラグ付けされ、契約ルールがそれに応じて適用されます。

これで、 *ACME Smile*のテンプレート条件に、これらのSKUが存在するたびに注文ごとに5%を支払う、といったルールを追加できます。参照： [カテゴリ、SKU、またはプロモコードの例外リストに対する支払いルールを設定する](/brand/ja/what-would-you-like-to-learn-about/account-administration/program-settings/exception-lists/set-payout-rules-for-exception-lists.md) をご覧ください。


---

# 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/ja/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-inside-the-parentheses.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.
