# 快速认识正则

**正则替换**是一个强大的替换工具。

它能自动把 **AI 输出的**，瞬间替换成Creator想要给User看的内容。

#### 正则可以

* **解决代码对 Token 的占用**

  复杂的代码预填在系统，不占用AI输出Token。
* **丰富AI输出的交互**

  原本因AI上下文能力有限，无法实现的美化效果，可以通过正则实现。
* **美化卡输出速度更快**

  减少AI输出内容，降低美化卡单次输出时间。
* **过滤AI输出的文本**

  过滤不想AI输出的内容，如思维链、爆设定等。

#### **工作原理是什么**

**识别：** 系统识别出 AI 输出里的，任意需要替换的信息。

**替换：** 瞬间把它们替换成你设定好的、更丰富的内容。

一句话就是，正则可以做到 **“当AI输出...时，系统要把它替换成...”**

比如，我要丰富**环境数据**的美化样式，创建一条正则可以完成以下任务：

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td><strong>当AI输出上方的文本</strong></td><td>&#x3C;环境数据>...&#x3C;/环境数据></td><td><a href="https://cdn.mufy.ai/images/d0034eb6-56ae-4337-d90c-940d82468b00/public">https://cdn.mufy.ai/images/d0034eb6-56ae-4337-d90c-940d82468b00/public</a></td></tr><tr><td><strong>系统将其替换为代码</strong></td><td>` ` `html    ` ` `</td><td><a href="https://cdn.mufy.ai/images/040919af-b249-497a-208a-bd59a8aa8800/public">https://cdn.mufy.ai/images/040919af-b249-497a-208a-bd59a8aa8800/public</a></td></tr><tr><td><strong>最终对user展示为</strong></td><td>渲染好的美化</td><td><a href="https://cdn.mufy.ai/images/b5b82d9c-625a-4a93-aab7-dec4cf760100/public">https://cdn.mufy.ai/images/b5b82d9c-625a-4a93-aab7-dec4cf760100/public</a></td></tr></tbody></table>

**这样有什么好处？**

**原本**AI需要输出完整的代码，**现在**只需要输出“关键文本信息”

AI不用再输出代码占用token

AI输出速度大大增加

#### 可以用正则实现

1. 让复杂的代码出现在AI聊天中，[大地图组件](/documentation/guan-yu-zheng-ze/you-qu-an-li/di-tu-zu-jian.md)，[小手机](/documentation/guan-yu-zheng-ze/you-qu-an-li/mumu-xiao-shou-ji.md)，[输出表情包](/documentation/guan-yu-zheng-ze/you-qu-an-li/biao-qing-bao-an-li.md)，等等....
2. 过滤AI输出的文本，拦截AI思维链，爆设定等...
3. 丰富AI文本样式，多角色气泡样式不同，等等...

*更多玩法，等待探索......*


---

# Agent Instructions: 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:

```
GET https://docs.mufy.ai/documentation/li-ji-kai-shi/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
