工具星球ToolPlanet

文本替换Text & Regex Replace

实时字面量和正则替换,支持捕获组、忽略大小写、多行匹配、仅替换首处与超时保护。Find and replace literal text or JavaScript regex matches locally, including capture groups, case-insensitive matching, multiline anchors and dotAll. Isolated computation with timeout protection.

按原样文本匹配,不执行正则;$、反斜杠等字符按字面量替换。

请输入查找文本

文本替换使用指南Text & Regex Replace: guide

在线文本查找替换,支持字面量与 JavaScript 正则模式、捕获组引用、忽略大小写、多行与点匹配换行;隔离计算带超时保护,文本不上传。Find and replace literal text or JavaScript regex matches locally, including capture groups, case-insensitive matching, multiline anchors and dotAll. Isolated computation with timeout protection.

  1. 粘贴文本并填写查找内容和替换值,选择字面量或正则模式。Paste text, enter the search and replacement, and choose literal or regex mode.
  2. 设置替换全部或首个、匹配选项,检查自动更新的结果后复制或下载。Choose first or all matches and flags, inspect the live result, then copy or download it.

正则替换如何引用捕获组?How do replacement capture groups work?

使用 $1、$2 或 $<name> 引用捕获组,$& 引用完整匹配,$$ 输出美元符号。使用 JavaScript 正则语法,查找内容无需两侧斜杠。字面量模式不解释替换符号;正则计算超过一秒自动停止。Use $1, $2 or $<name> for captures, $& for the full match and $$ for a dollar sign. Enter JavaScript regex without enclosing slashes. Literal mode does not interpret replacement tokens. Regex processing stops after one second.

免费使用,无需注册。工具输入在浏览器本地处理;网站访问统计不包含工具输入内容。Free to use, no registration. Tool input is processed locally in your browser and is not included in website analytics.