查找與替換

按普通字串或規則運算式查找匹配内容,並替換成指定文本。

輸入: 文本結果: 文本

文本輸入

工具選項

範例

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)