Removing empty lines in Notepad++

前端 未结 22 1837
时光取名叫无心
时光取名叫无心 2020-11-28 00:04

How can I replace empty lines in Notepad++? I tried a find and replace with the empty lines in the find, and nothing in the replace, but it did not work; it probably needs r

相关标签:
22条回答
  • 2020-11-28 00:43

    There is a plugin that adds a menu entitled TextFX. This menu, which houses a dizzying array of quick text editing options, gives a person the ability to make quick coding changes. In this menu, you can find selections such as Drop Quotes, Delete Blank Lines as well as Unwrap and Rewrap Text

    Do the following:

    TextFX > TextFX Edit > Delete Blank Lines
    TextFX > TextFX Edit > Delete Surplus Blank Lines
    
    0 讨论(0)
  • 2020-11-28 00:43

    This worked for me:

    1. Press ctrl + h (Shortcut for replace)
    2. Write one of the following regex in find what box. [\n\r]+$ or ^[\n\r]+
    3. Leave Replace with box blank
    4. In Search Mode, select Regex
    5. Click on Replace All

      Done!
    0 讨论(0)
  • 2020-11-28 00:44

    You can search for the following regex: ^(?:[\t ]*(?:\r?\n|\r))+ and replace it with empty field

    0 讨论(0)
  • 2020-11-28 00:46

    enter image description here

    Sometimes \n\r etc not work, here to figure it out, what your actually regular expression should be.

    Advantage of this trick: If you want to replace in multiple file at once, you must need this method. Above will not work...

    0 讨论(0)
  • 2020-11-28 00:47

    You need something like a regular expression.

    You have to be in Extended mode

    If you want all the lines to end up on a single line use \r\n. If you want to simply remove empty lines, use \n\r as @Link originally suggested.

    Replace either expression with nothing.

    0 讨论(0)
  • 2020-11-28 00:48

    1) Ctrl + H ( Or Search

    0 讨论(0)
提交回复
热议问题