> 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/zh/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-outside-the-parentheses.md).

# 括号外的正则表达式

[正则表达式](/brand/zh/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-explained.md) （或正则表达式）是一种代码，当你希望将上传的产品 SKU、类别或促销代码中的部分字符与传递给 impact.com 的转化值进行匹配时，可以使用它。你可以将正则表达式与 impact.com 的 Match Expression 工具一起使用，以识别你希望以不同方式支付佣金的产品 SKU、类别或促销代码。

#### 括号外

你放置的正则表达式 [在内部](/brand/zh/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. 从顶部导航栏中，选择 ![](/files/34cff7cafbbfcd416778a35b63cb058c27bcda8b) **\[用户资料] → 设置**.
2. 在右侧，在……下方 *例外列表* 部分下，选择 **SKU**.
3. 选择 **添加新的 SKU 列表**.
4. 输入一个 **列表名称**.
5. 选择 **设置的事件类型** 你要与此 SKU 列表关联的项目。

#### 步骤 2：设置正则表达式

1. 选择 **显示高级设置** 并在其中输入你的正则表达式 **匹配表达式** 字段中添加 1 个。
   * 在括号内，添加你想要匹配的内容：
     * 添加正则表达式字符 `\w{3}` 以匹配 SKU 列表中项目的 3 字母“文本”部分。
   * 在括号外：
     * 添加 `^` 在左括号前，用于断言位于行首，确保前面没有任何字符。
     * 添加 `\d{5}` 在右括号后，只有当 3 字母文本组合后面有 5 位数字时，才匹配括号中的表达式。
     * 最终表达式应为 `^(\w{3})\d{5}`.

       <div data-with-frame="true"><figure><img src="/files/6461a3acfd66dddb01f1d6f86622a04345a98ec8" alt=""><figcaption></figcaption></figure></div>
2. 选择 **保存并添加项目**.

#### 步骤 3：添加例外列表项

1. 以以下 2 种方式之一列出你要匹配的值：
   * **手动添加项目** 通过在以下位置输入所有当前轮胎品牌 SKU： *SKU* 字段。

     <div data-with-frame="true"><figure><img src="/files/31a7aaa1c987a1d6d41cfabeb78e9d007396e7d8" alt=""><figcaption></figcaption></figure></div>
   * 或者， **上传 CSV 或 Excel 文件** 在以下位置下列出所有当前轮胎品牌 SKU： *SKU* 列。

     * 请参见 [创建 SKU 例外列表](/brand/zh/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/77ead5f7a848ddf21ad98672a9073f3a415eff0f" alt="" width="561"><figcaption></figcaption></figure></div>
2. 要添加新的轮胎品牌，只需手动添加新的 SKU 列表项，或通过上传添加。
   * 例如，添加 **BHG123** 用于一款 3 字母品牌代码的新轮胎 *BHG*.
3. 选择 **保存**.
   * 你会在……中看到新的 SKU 列表 *SKU 列表* 页面中。

#### 下一步是什么？

既然你已经设置了正则表达式 Match Expression 并添加了相应的 SKU 列表项，那么所有 *ACME Auto*其轮胎将作为异常列表的一部分进行匹配。未来的任何轮胎品牌（假设它们的 SKU 也以 3 个字母开头、后跟 5 个数字）都可以在需要时添加到 SKU 列表中。任何与正则表达式匹配的传入转化都会被标记为异常列表的一部分，并相应应用合同规则。

现在你可以将规则添加到 *ACME Auto*的模板条款，例如每当这些 SKU 出现时降低返利。参见 [为 SKU 例外列表设置支付](/brand/zh/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/zh/what-would-you-like-to-learn-about/platform-features/promo-codes/regular-expression/regex-outside-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.
