Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> Windows 技巧

UltraEdit 一鍵刪除文件大量空行:正則表達式替換技巧

編輯:Windows 技巧

蒐集的文章常含大量空行,手動刪除太慢。UltraEdit 內建正則替換功能,一鍵清空所有空行。

操作步驟

  1. 用 UltraEdit 開啟檔案。
  2. 選單 Search → Replace(或 Ctrl+R)。
  3. 在「取代」對話框:
    ✅ 勾選 Regular Expression(正則表達式)
    🔍 Find what: %[ ^t]++^p
    (注意:^t 前有一個空格,代表「空白或 Tab」重複一次以上,後接換行符)
    🔁 Replace with: 留空
  4. 點 Replace All 或 Start,所有空行瞬間消失。
原理說明: 該表達式匹配「僅含空白/Tab 的行 + 換行符」,替換為空即等於刪除整行。同樣邏輯適用於 EditPlus 等支援正則的編輯器。
Copyright © Windows教程網 All Rights Reserved