> 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. 选择 **显示高级设置** 并在 **匹配表达式** 字段中输入你的正则表达式。
   * 在括号内，添加你想匹配的内容：
     * 添加正则表达式字符 `\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/chuang-jian-sku-li-wai-lie-biao.md) 了解更多信息。

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