🔧 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)中使用
- 計算結果僅供參考,請以實際應用場景為準