我如何才能找到/替换所有CR/LF字符在notepad++ ?

我正在寻找一些相当于微软Word中的^p特殊字符。


当前回答

我在notepad++中打开文件,并在几个步骤中进行替换:

将所有“\r\n”替换为“\r\n” 替换所有”;“\r\n”和“\r\n” 将所有“\r\n”替换为“”

这将把所有的断点放在它们应该在的位置,并删除那些破坏文件的断点。

这对我很管用。

其他回答

使用高级搜索选项(Ctrl + R)并使用键盘快捷键CRLF (Ctrl + M)插入回车符。

我在notepad++中打开文件,并在几个步骤中进行替换:

将所有“\r\n”替换为“\r\n” 替换所有”;“\r\n”和“\r\n” 将所有“\r\n”替换为“”

这将把所有的断点放在它们应该在的位置,并删除那些破坏文件的断点。

这对我很管用。

我在查找/替换窗口中使用\r\n个正则表达式时运气不太好。

然而,这适用于notepad++ v4.1.2:

Use the "View | Show end of line" menu to enable display of end of line characters. (Carriage return line feeds should show up as a single shaded CRLF 'character'.) Select one of the CRLF 'characters' (put the cursor just in front of one, hold down the SHIFT key, and then pressing the RIGHT CURSOR key once). Copy the CRLF character to the clipboard. Make sure that you don't have the find or find/replace dialog open. Open the find/replace dialog. The 'Find what' field shows the contents of the clipboard: in this case the CRLF character - which shows up as 2 'box characters' (presumably it's an unprintable character?) Ensure that the 'Regular expression' option is OFF.

现在您应该能够根据需要进行计数、查找或替换。

在替换对话框中,您要将搜索模式设置为“扩展”。正常或正则表达式模式不工作。

然后只需要找到"\r\n"(对于unix文件只需要\n,对于mac格式文件只需要\r),然后将替换值设置为你想要的任何值。

做这个设置。菜单->视图->显示符号->取消勾选显示行结束