查找与替换

按普通字符串或正则表达式查找匹配内容,并替换成指定文本。

输入: 文本结果: 文本

文本输入

工具选项

案例

Normalize repeated spaces in a copied HTTP request

输入

GET    /health  HTTP/1.1
Host:   example.org

Expected answer

GET /health HTTP/1.1
Host: example.org
查找
{"option":"Regex","string":"[ \\t]+"}
替换为
全局匹配
On
不区分大小写
Off
多行匹配
On
点号匹配所有字符
Off
Redact a demo bearer token while retaining the header name

输入

Authorization: Bearer DEMO_TOKEN_NOT_VALID
Accept: application/json

Expected answer

Authorization: Bearer [REDACTED]
Accept: application/json
查找
{"option":"Regex","string":"(Authorization: Bearer )\\S+"}
替换为
$1[REDACTED]
全局匹配
On
不区分大小写
Off
多行匹配
On
点号匹配所有字符
Off
Move endpoint URLs to a new hostname literally

Simple string treats the dots as dots, rather than regular-expression wildcards.

输入

https://old.example.org/v1/status
https://old.example.org/v1/jobs

Expected answer

https://api.example.org/v1/status
https://api.example.org/v1/jobs
查找
{"option":"Simple string","string":"old.example.org"}
替换为
api.example.org
全局匹配
On
不区分大小写
Off
多行匹配
On
点号匹配所有字符
Off
Complete only the first item in a task list

输入

TODO: write test
TODO: deploy

Expected answer

DONE: write test
TODO: deploy
查找
{"option":"Simple string","string":"TODO"}
替换为
DONE
全局匹配
Off
不区分大小写
Off
多行匹配
On
点号匹配所有字符
Off
Disable debug flags with case-insensitive line matching

输入

DEBUG=true
port=8080
debug=true

Expected answer

debug=false
port=8080
debug=false
查找
{"option":"Regex","string":"^debug=(?:true|false)$"}
替换为
debug=false
全局匹配
On
不区分大小写
On
多行匹配
On
点号匹配所有字符
Off

参数

参数默认值输入与选项
查找{"option":"Regex","string":""}密钥或文本编码: 正则表达式, Extended (\n, \t, \x...), Simple 字符串
替换为""支持 \n、\r 和 \t 等转义序列
全局匹配true开启或关闭
不区分大小写false开启或关闭
多行匹配true开启或关闭
点号匹配所有字符false开启或关闭

相关工具

实用工具

操作参考

查看原始技术文档 (English)