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

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


当前回答

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

其他回答

只需在find中执行\r,并在replace字段中使用空白进行替换,这样所有内容都将上升到一行。然后执行查找和替换(在我的例子中是分号)并替换为;\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.

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

我在NP v6.9中完全无法做到这一点。 我发现用微软的Word (2K)软件就足够简单了。

打开文档,点击编辑->replace。

然后在搜索框的底部,点击“更多”,然后找到“特别”按钮,他们有一些东西给你。对于Dos样式,我使用“段落”样式。这是一双橱窗里的cr。

如果你需要做一个复杂的regexp替换,包括\r\n,你可以通过三步方法来解决这个限制:

将所有的\r\n替换为一个标签,例如#GO#→检查'Extended',将\r\n替换为#GO# 执行regexp,例如从html书签中删除多行ICON="*"→检查regexp,替换ICON=.[^"]+。> by > 返回\r\n→勾选“扩展”,将#GO#替换为\r\n

这似乎是一个常见问题,提供的解决方案是:

Simple search (Ctrl+H) without regexp You can turn on View/Show End of Line or view/Show All, and select the now visible newline characters. Then when you start the command some characters matching the newline character will be pasted into the search field. Matches will be replaced by the replace string, unlike in regex mode. Note 1: If you select them with the mouse, start just before them and drag to the start of the next line. Dragging to the end of the line won't work. Note 2: You can't copy and paste them into the field yourself. Advanced search (Ctrl+R) without regexp Ctrl+M will insert something that matches newlines. They will be replaced by the replace string.