> 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. 選択 **詳細設定を表示** し、正規表現を **Match Expression** フィールドに入力します。
   * 括弧内には、一致させたい値のみを追加します。
     * 歯科用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 が存在するたびに 1 注文あたり 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 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.
