正则替换预览器
实时预览正则替换,显示详细差异和统计
**功能特性:**
- 实时预览文本替换结果
- 支持捕获组 ($1, $2, ${name})
- 特殊模式:$& (完整匹配)、$` (前缀)、$' (后缀)、$$ (字面量 $)
- 显示变更的高亮差异
- 详细的替换统计信息
**示例用法:**
模式:`\b(\d{4})-(\d{2})-(\d{2})\b`
替换:`$2/$3/$1`
输入:"Dates: 2024-01-15 and 2024-02-20"
输出:"Dates: 01/15/2024 and 02/20/2024"
API 文档
请求端点
POST /zh/api/tools/regex-replace-previewer
请求参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| textInput | textarea | 是 | - |
| pattern | text | 是 | 输入要搜索的正则表达式模式 |
| replacement | text | 是 | 使用 $1, $2, ${name} 引用捕获组。特殊:$& (完整匹配)、$` (前缀)、$' (后缀)、$$ (字面量 $) |
| flags | text | 否 | 正则标志:g (全局)、i (不区分大小写)、m (多行) 等 |
| previewMode | select | 否 | 选择替换预览的显示方式 |
响应格式
{
"key": {...},
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}
JSON数据:
JSON数据
AI MCP 文档
将此工具添加到您的 MCP 服务器配置中:
{
"mcpServers": {
"elysiatools-regex-replace-previewer": {
"name": "regex-replace-previewer",
"description": "实时预览正则替换,显示详细差异和统计",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=regex-replace-previewer",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}
你可以串联多个工具,比如:`https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`,最多20个。
如果遇见问题,请联系我们:[email protected]