> 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) Regex（または正規表現）は、コンバージョン時にimpact.comへ渡される値に、アップロードした商品SKU、カテゴリ、またはプロモコードの文字列の一部を一致させたいときに使えるコードの一種です。impact.comのMatch Expressionツールとregexを使って、異なる支払いを行いたい商品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用の正規表現を設定し、以下のセクションで示すように、Match Expressionツールを使って不完全なSKU例外リスト内の一致を見つけることができます。

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

1. 上部ナビゲーションバーから、 ![](/files/173ecabf39fd91e83f3ac16fba44d8e9c845708d) **\[ユーザープロフィール] → 設定**.
2. 右側の、〜の下に *例外リスト* セクションで、 **SKU**.
3. 選択します **新しいSKUリストを追加**.
4. 入力してください **リスト名**.
5. 次を **イベントタイプ** このSKUリストに関連付けたい項目を追加します。

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

1. 選択します **詳細設定を表示** そして、正規表現を次の欄に入力します: **一致式** フィールドに追加できます。
   * かっこの内側には、一致させたい値のみを追加します:
     * 歯科製品のSKUがこの3つの文字列で始まることがわかっているので、それらを正規表現の記号で区切って追加します `|` これはOR（または）を意味します。
   * かっこの外側には、照合を絞り込むのに役立つ任意の正規表現を追加します:
     * 正規表現の文字を追加します `^` 開始かっこの前に置いて、行の先頭位置を示し、その前に文字がないことを保証します。
     * 正規表現の文字を追加します `.` 終了かっこの後に置いて、行末記号を除く後続の任意の文字（例: 数字、英字、ハイフン）に一致させます。
     * 正規表現の文字を追加します `*` ピリオドの後に置いて、任意の回数の一致（つまり0回から無制限回まで）を探します。
   * 最終的な式は次のようになります `^(TOOTH|SMILE|SHINE).*`.
2. 選択します **保存して項目を追加**.

   <div data-with-frame="true"><figure><img src="/files/76c0bfcfae210943e8e0f909beb9902260d247bb" alt="" width="563"><figcaption></figcaption></figure></div>

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

1. 一致させたい値は、次の2通りの方法のいずれかで一覧にします:
   * **項目を手動で追加** TOOTH、SMILE、SHINEを次に入力して *Sku* フィールドの値が削除されます。

     <div data-with-frame="true"><figure><img src="/files/f2c581d348a95ae92471d89e2b33133f4d78f560" 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-category-and-sku-exception-lists.md#create-a-sku-exception-list-0-4) 詳細はこちら。

     <div data-with-frame="true"><figure><img src="/files/751723ef7488471304e63703c2b7161e9f760c47" alt="" width="374"><figcaption></figcaption></figure></div>
2. 選択します **保存**.
   * 新しいSKUリストは次の場所に表示されます *SKUリスト* 画面。

#### 次は？

正規表現の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/create-category-and-sku-exception-lists.md#set-payouts-for-a-sku-exception-list-0-5) をご覧ください。


---

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