Home  >  Article  >  Development Tools  >  How to find and replace "line break" in Notepad++

How to find and replace "line break" in Notepad++

藏色散人
藏色散人forward
2020-08-06 13:29:199452browse

The following tutorial column of notepad will introduce to you the method of finding and replacing "line breaks" in Notepad. I hope it will be helpful to friends in need!

How to find and replace

important:

The content of this article is based on Notepad version 7.5.1. For the convenience of writing, unless otherwise specified, the following content refers to the operation under this software version.

1. Search and replace "line break"

1. Set "Show end of line character"

For more clarity If you see the change of line breaks, first make the following settings:
View-> Show symbols-> Show end-of-line characters
How to find and replace line break in Notepad++

Then create a new one Text, enter any content in it, and you will see that the "line break" is CRLF, that is, \r\n.

2. Find and replace "newline character"

  • Ctrl H, open the replacement dialog box, Search mode Select Extension or regular expression to make find target and replace with to support matching of both strings and special characters;
  • Then enter \r\n in Find Target to match the carriage return and line feed characters in the text;
  • in Replace with and enter the characters you want to replace;

How to find and replace line break in Notepad++

2. Expansion: Find and replace "empty lines" and whitespace characters

The following are some commonly used search and replacement situations:
(provided that regular expression mode is selected)

Find target Replace with Description
\r\ n ,\r\n Add a comma at the end of the line
\r \n
Replace with empty, that is, merge multiple lines into one line
\r\n \n Replace the newline character under windows with the newline character under linux
\n
Replace \n with nothing, that is, replace the newline character under Windows with the newline character under Mac
, \r\n Replace all commas with newlines
\r\n\r\n \r\n Remove blank lines
1\s\s 1 Remove the two spaces after 1, one of which \s represents a space
1Two half-width spaces 1 You can directly match 1 followed by two half-width spaces , the same effect as the above\s
\r\n \r\n\t Add a tab character at the beginning of each line, which is the effect of four half-width spaces

Recommended tutorial: "notepad

The above is the detailed content of How to find and replace "line break" in Notepad++. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete