> ## Documentation Index
> Fetch the complete documentation index at: https://rpa.bazhuayu.com/helpcenter/llms.txt
> Use this file to discover all available pages before exploring further.

# 文本替换(正则替换)

## 指令说明

**描述：** 将原始文本中的内容替换为指定的文本内容

## 参数说明

<Tabs>
  <Tab title="常规">
    <img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/replacetextcommand-01.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=55c1c378e544a790afd9d4df7257e205" alt="文本替换(正则替换)指令参数面板" width="645" height="630" data-path="helpcenter/commands/data-processing/images/replacetextcommand-01.png" />

    | 参数            | 说明                                            |
    | ------------- | --------------------------------------------- |
    | **原始文本**      | 输入文本字符串或者选择一个包含字符串的变量                         |
    | **替换方式**      | 选择一种内客的替换方式： 文本替换：需填写「被替换内容」、 正则替换：需填写「正则表达式」 |
    | **被替换内容**     | 填入被替换的内容                                      |
    | **正则表达式**     | 填入匹配内容的正则表达式                                  |
    | **只替换第一个匹配项** | 是否只替换第一个匹配项                                   |
    | **忽略大小写**     | 是否忽略大小写                                       |
    | **替换为**       | 输入匹配到的内容 替换为，支持替换为空                           |
  </Tab>

  <Tab title="高级">
    本指令暂无高级参数。
  </Tab>
</Tabs>

## 使用示例

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/replacetextcommand-03.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=70c404417c12d9abae4607f9fb0bdeca" alt="文本替换(正则替换)使用示例" width="636" height="628" data-path="helpcenter/commands/data-processing/images/replacetextcommand-03.png" />

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/replacetextcommand-02.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=21d0c60096fab2747039c1994778d58c" alt="文本替换(正则替换)使用示例 - 流程搭建" width="905" height="253" data-path="helpcenter/commands/data-processing/images/replacetextcommand-02.png" />

**该流程执行逻辑：**

本例演示【文本替换(正则替换)】指令的配置与执行：

1. 在【替换文本】中输入原文本“八爪鱼RPA是个好工具”，将查找内容设为“好工具”。
2. 把替换内容设为“自动化机器人”，并设置结果变量。
3. 执行指令后，结果变量得到“八爪鱼RPA是个自动化机器人”。

### 效果展示

<img src="https://mintcdn.com/bazhuayu-rpa-docs/QLw4prvAN-mejJU5/helpcenter/commands/data-processing/images/replacetextcommand-04.png?fit=max&auto=format&n=QLw4prvAN-mejJU5&q=85&s=0c92b88af3effc441ef45d9c02a9e67c" alt="文本替换(正则替换)使用示例 - 效果展示" width="1340" height="218" data-path="helpcenter/commands/data-processing/images/replacetextcommand-04.png" />

<Info>
  使用指令过程中遇到问题？前往 [八爪鱼RPA 开发者社区问答板块](https://rpa.bazhuayu.com/community/questions) 提问，获取官方与社区帮助。
</Info>
