Home > Article > Development Tools > How to replace empty lines in notepad++
The first method: No need to use regular expressions, just use the system’s own functions.
Related recommendations: "Notepad using graphic tutorial"
Second method: through regular expressions Expression
1, \r\n escape character replacement
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
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.
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.
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!