🔧 Advanced Find & Replace
查找
替换为
💡 支持捕获组引用:$1 $2 $3... 表示第 N 个捕获组;$& 表示整个匹配;$` 表示匹配前内容;$' 表示匹配后内容
📋 替换结果
请输入文本...
📚 深度解析:高级替换(正则)
💡 常见使用场景
- 批量改写:用正则捕获组重排文本,如把「姓,名」转「名 姓」。
- 数据规整:统一日期格式、替换域名、清洗噪声字符。
- 模板渲染:用反向引用把抽出内容填回新模板。
邮箱域名统一
用正则「@(qq|163).com」替换为「@corp.com」,把两域名邮箱统一到企业域;捕获组 $1 可在替身里引用,实现局部改写。
❓ 常见问题(FAQ)
- 捕获组怎么用?
- 用括号分组,替换串里以 $1、$2 引用;如「([0-9]{4})-([0-9]{2})」替换为「$2/$1」即交换月年。注意转义与全局标志。
- 会改坏内容吗?
- 正则匹配范围广,建议先在小样本预览再应用到全量;涉及破坏性替换务必备份原文本。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Match mode | advanced replace supports literal and regex matching with metacharacter escaping | ECMA-262, regular expressions |
| Capture reference | the replacement may reference capture groups numbered from one | IEEE 1003.1, POSIX regular expressions |
| Global replacement | the default replaces the first match only and global mode needs a flag | ECMA-262, regular expressions |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准