Notepad++替换格式符号(如换行符、Tab符等)

(前提是要选中 正则表达式模式)

查找目标 替换为 说明
\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





posted @ 2020-05-24 15:26  柠檬茶多放糖  阅读(11082)  评论(0编辑  收藏  举报