> 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-outside-the-parentheses.md). Agents can also search and read this documentation through its [MCP server](https://help.impact.com/~gitbook/mcp).

# かっこ外の正規表現

[正規表現](https://help.impact.com/brand/ja/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-explained.md) （Regular Expressionの略）とは、アップロードした商品SKU、カテゴリ、プロモーションコードの一部の文字列と、コンバージョン時にimpact.comへ渡される値を照合するために使えるコードの一種です。impact.comの照合式ツールで正規表現を使うと、異なる報酬を支払いたい商品SKU、カテゴリ、プロモーションコードを特定できます。

#### 括弧の外側

配置する正規表現は [内側の](https://help.impact.com/brand/ja/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-inside-the-parentheses.md) Match Expression ツールの括弧内で、関連する例外リストに含まれる照合対象の値を表します。SKU、カテゴリ、プロモーションコードのリスト内の項目を厳密に照合する以外のことをしたい場合は、括弧の外側に正規表現を追加する必要があります。括弧の外側にある演算子は、括弧で囲まれた値と、対応するSKU、カテゴリ、プロモーションコードを持つ受信コンバージョンを照合します。

#### シナリオの例

貴社ブランドの *ACME Auto*は、すべてのタイヤについてパートナーへの報酬を減額したいと考えています。 *ACME Auto* は、将来的にカタログへ新しいタイヤブランドを追加する予定のため、すべてのタイヤブランドを網羅したリストを持っていません。しかし、すべてのタイヤSKUは、タイヤブランドを表す3文字に続いて5桁の数字で構成されることがわかっています（例： `ABC12345`, `DLY76565`、および `XTX85037`).

すべてのタイヤSKUは3文字に続いて5桁の数字で構成されるため、そのSKUパターンに対する正規表現を設定し、Match Expression ツールを使って現在のSKU例外リスト内で一致するものを見つけることができます。将来的には、 *ACME Auto* は必要に応じて、3文字のブランドコードを追加できます。

#### 手順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**.
3. を選択します。 **新しいSKUリストを追加**.
4. を選択し、 **リスト名**.
5. を入力します。 **イベントタイプ** を選択して、このSKUリストに関連付けます。

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

1. 「 **詳細設定を表示** 」を選択し、 **照合式** フィールドに正規表現を入力します。
   * 括弧の内側には、照合対象を追加します。
     * 正規表現文字 `\w{3}` を追加して、SKUリスト内の項目に含まれる3文字の「テキスト」部分に一致させます。
   * 括弧の外側：
     * 追加 `^` 開き括弧の前に追加すると、行頭の位置を指定でき、前に文字がないことを保証できます。
     * 追加 `\d{5}` 閉じ括弧の後に追加すると、3文字のテキストの後に5桁の数字が続く場合にのみ、括弧で囲まれた式が一致します。
     * 最終的な式は次のとおりです。 `^(\w{3})\d{5}`.

       <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%2Fgit-blob-cd8843c09c0dd64c0fa71082298e148a3e57e18d%2F4fde8c68c10a2de3343ef0f40e7c1abca5285c0e8143ae5f2d66db0a2c0e27ea.png?alt=media" alt=""><figcaption></figcaption></figure></div>
2. 選択 **保存して項目を追加**.

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

1. 照合したい値を、次の2つの方法のいずれかでリストに追加します。
   * **項目を手動で追加** を選択し、現在のタイヤブランドのSKUをすべて *Sku* フィールドに入力します。

     <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%2Fgit-blob-6811d8411a2314cf77dd143a143c0426a3e0151f%2Fe808470f9e8dd7f18343707c692918146215c20c064904c4fcf78cf808c94b84.png?alt=media" alt=""><figcaption></figcaption></figure></div>
   * または、 **CSVまたはExcelファイルをアップロード** して、現在のタイヤブランドのSKUをすべて *SKU* 列に記載します。

     * 詳しくは、 [SKU例外リストを作成する](https://help.impact.com/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="561"><figcaption></figcaption></figure></div>
2. 新しいタイヤブランドを追加するには、新しいSKUリスト項目を手動で追加するか、アップロードするだけです。
   * たとえば、新しいタイヤの3文字のブランドコードが **BHG123** の場合、 *BHG*.
3. を選択します。 **保存**.
   * 新しいSKUリストは *SKUリスト* 画面に表示されます。

#### 次のステップ

正規表現のMatch Expressionを設定し、対応するSKUリスト項目を追加したので、 *ACME Auto*のタイヤはすべて例外リストの一部として照合されます（注：ブランド名に続くSKUが3文字と5桁の数字で構成される場合）。今後、新しいタイヤブランドが登場したら、必要に応じてSKUリストに追加できます。正規表現に一致する受信コンバージョンは例外リストの一部としてフラグ付けされ、それに応じて契約ルールが適用されます。

次に、 *ACME Auto*のテンプレート条項に、これらのSKUが含まれる場合に報酬を減額するなどのルールを追加できます。詳しくは、 [カテゴリ、SKU、またはプロモーションコードの例外リストに対する報酬ルールの設定](https://help.impact.com/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-outside-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.
