> 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).

# かっこ内の正規表現

[正規表現](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-outside-the-parentheses.md) 正規表現をリスト全体に適用できます。

#### シナリオの例

貴社ブランドの *ACME Smile*では、顧客が歯科関連商品を購入した際に、パートナーへ5%の報酬を支払いたいと考えています。 *ACME Smile* 貴社ブランドでは、歯科関連商品の全SKUを網羅したリストを用意できません。商品を常に廃止したり、新たに追加したりしているためです。しかし、歯科関連商品のSKUがすべてTOOTH、SMILE、SHINEのいずれかで始まることは分かっています（例： `SHINE98763`, `SMILE987abc`, `TOOTH65abc64`).

歯科関連商品のSKUはすべてTOOTH、SMILE、SHINEのいずれかで始まるため、歯科関連商品のSKU全般に適用する正規表現を設定し、照合式ツールを使って、不完全なSKU例外リストの項目と照合できます。手順は以下のとおりです。

{% 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個以上（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ファイルをアップロードして、** 「SKU」 *SKU* 列にTOOTH、SMILE、SHINEを入力します。

     * 詳しくは、 [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="374"><figcaption></figcaption></figure></div>
2. を選択します。 **保存**.
   * 新しいSKUリストは *SKUリスト* 画面に表示されます。
     {% endstep %}
     {% endstepper %}

#### 次のステップ

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

次に、 *ACME Smile*のテンプレート規約にルールを追加できます。たとえば、これらのSKUが含まれる注文ごとに5%を支払うように設定できます。詳しくは、 [カテゴリ、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-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.
