> 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. 在顶部导航栏中，选择 ![](https://1186853034-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://1186853034-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. 通过以下两种方式之一列出你想匹配的值：
   * **手动添加项目** 通过在 *Sku* 字段。

     <div data-with-frame="true"><figure><img src="https://1186853034-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例外列表](/brand/zh/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://1186853034-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 列表项，或通过上传添加。
   * 例如，添加 **BHG123** 用于一款新的轮胎，其 3 字母品牌代码为 *BHG*.
3. 选择 **保存**.
   * 你会在 *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.
