(前提是要選中 正則表達式模式)
查找目標 | 替換為 | 說明 |
---|---|---|
\r\n | ,\r\n | 在行尾加上逗號 |
\r\n | 替換為空,即合並多行內容為一行 | |
\r\n | \n | 把 windows 下的換行符替換為 linux 下的換行符 |
\n | 把 \n 替換為空,即把 windows 下的換行符替換為 Mac 下的換行符 | |
, | \r\n | 把逗號全部替換成換行 |
\r\n\r\n | \r\n | 去掉空行 |
1\s\s | 1 | 去掉 1 后的兩個空格,其中一個 \s 表示一個空格 |
1兩個半角空格 | 1 | 可以直接在 1 后跟兩個半角空格來匹配,跟上面 \s 是一樣的效果 |
\r\n | \r\n\t | 在每行行首添加制表符,即四個半角空格的效果 |
版權聲明:本文為CSDN博主「媛測」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/lijing742180/java/article/details/85174564
Extended Search Mode
In extended mode, these escape sequences (a backslash followed by a single character and optional material) have special meaning, and will not be interpreted literally.
\n: the Line Feed control character LF (ASCII 0x0A)
\r: The Carriage Return control character CR (ASCII 0x0D)
\t: the TAB control character (ASCII 0x09)
\0: the NUL control character (ASCII 0x00)
\: the literal backalash character (ASCII 0x05C)
\b: the binary representation of a byte, made of 8 digits which are either 1’s or 0’s. †
\o: the octal representation of a byte, made of 3 digits in the 0-7 range
\d: the decimal representation of a byte, made of 3 digits in the 0-9 range
\x: the hexadecimal representation of a byte, made of 2 digits in the 0-9, A-F/a-f range.
\u: The hexadecimal representation of a two byte character, made of 4 digits in the 0-9, A-F/a-f range. In Unicode builds, finds a Unicode character (for instance, \u2020 matches the † char, in an UTF-8 encoded file). In ANSI builds, finds characters requiring two bytes, like in the Shift-JIS encoding. †
†NOTE: While some of these Extended Search Mode escape sequences look like regular expression escape sequences, they are not identical. Ones marked with † are different from or not available in regular expressions.
來源: https://npp-user-manual.org/docs/searching/#extended-search-mode