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)

 

posted @ 2023-01-28 03:14  ChuckLu  阅读(74)  评论(0编辑  收藏  举报