notepad++ 替換空行 Remove empty lines and spaces in Notepad++?

Remove empty lines and spaces in Notepad++?

回答1

To get rid of leading space(s) and all empty lines (even if the empty line contains spaces or tabs)

  1. Go to Search -> Replace
  2. Select "Regular expression" under Search mode.
  3. Use ^\s* for "Find what" and leave "Replace with" blank.
  4. Click Replace all

Regex explanation:

  • ^ means beginning of the line
  • \s* means any number (even 0) of whitespace characters. Whitespace characters include tab, space, newline, and carriage return.

 

回答2,

用菜單裏面自帶的功能

Edit -> Line Operations -> Remove Empty Lines or alternatively: Edit -> Line Operations -> Remove Empty Lines (Containing Blank characters)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章