Home  >  Article  >  Development Tools  >  How to replace empty lines in notepad++

How to replace empty lines in notepad++

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-09 16:27:1010377browse

How to replace empty lines in notepad++

The first method: No need to use regular expressions, just use the system’s own functions.

How to replace empty lines in notepad++

Related recommendations: "Notepad using graphic tutorial"

Second method: through regular expressions Expression

1, \r\n escape character replacement

How to replace empty lines in notepad++

Press ctrl h to pop up the search and replace box, and define the search mode as Expansion (\n, \r…)

Search target: \r\n\r\n

is replaced with: \r\n

or

Select Replace, set the search mode to regular expression, enter ^\s in the search box, leave the replace box blank, and click "Replace All" (select all first).

Search target: ^\s

Replace with: Leave blank

How to replace empty lines in notepad++

Third method: Download and install the plug-in TextFX

First download and install the plug-in TextFX, restart it after downloading, and then find TextFX -> TextFX Edit -> Delete blank lines in the menu bar.

How to replace empty lines in notepad++

Before using, remember to select the area first, and then operate.

Here are some additions

Now, we use regular expressions to replace multiple blank lines with only one blank line.

How to replace empty lines in notepad++

The following are some continuations for line breaks and so on

Notepad To use regular expression search, you first need to check the "Regular Expression" in the lower left part of the find/replace window. Formula (E)”

\r\n means line feed, where \r means carriage return

\s Space

1. Replace the specified character with a newline character, such as Replace "," in the csv file with newlines

Search target:,

is replaced with: \r\n

2. Indent the first line, and indent each line Add 4 spaces before the line

Search target: \r\n

Replace with: \r\n {four half-width spaces}

3. In each line break Insert a blank line after

Search target: \r\n

Replace with: \r\n\r\n

The above is the detailed content of How to replace empty lines in notepad++. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn