从某些区域删除换行符不是全部 |记事本++
Remove newlines from certain areas not all | Notepad++
如何仅在某些返回区域使用 notepad++ 删除换行符 ('\n')。
例如
Keyword1 "this is the text that I want to
take the new lines out of. But not
the area around it"
Keyword2
我希望它看起来像这样:
Keyword1 "this is te text that I want to take the new lines out of. But not the area around it"
Keyword2
我只想从这些区域(.txt 文件中有多个)而不是整个文件中取出换行符。
谢谢
您需要弄清楚这两种情况是如何区分的?与要删除的换行符相比,哪些字符始终位于换行符之前或之后。
在您的简短示例中,似乎要删除的换行符后跟几个 spaces(或制表符),而要保留的换行符则没有。
因此您可以用 </code> 替换 <code>\r\n[\t ]{3,}
,确保选择 "regular expression"。这将用单个 space.
替换后跟三个或更多制表符和 space 的任何换行符
您可能需要根据文件中的行尾更改 \r\n
部分。尝试使用菜单 => View => Show symbol => Show end of line 查看该行您文件中的结尾。
怎么样:
查找内容:\R\h+
替换为:a space
其中 \R
代表任何类型的换行符,\h
代表任何类型的水平 space。
如何仅在某些返回区域使用 notepad++ 删除换行符 ('\n')。
例如
Keyword1 "this is the text that I want to
take the new lines out of. But not
the area around it"
Keyword2
我希望它看起来像这样:
Keyword1 "this is te text that I want to take the new lines out of. But not the area around it"
Keyword2
我只想从这些区域(.txt 文件中有多个)而不是整个文件中取出换行符。
谢谢
您需要弄清楚这两种情况是如何区分的?与要删除的换行符相比,哪些字符始终位于换行符之前或之后。
在您的简短示例中,似乎要删除的换行符后跟几个 spaces(或制表符),而要保留的换行符则没有。
因此您可以用 </code> 替换 <code>\r\n[\t ]{3,}
,确保选择 "regular expression"。这将用单个 space.
您可能需要根据文件中的行尾更改 \r\n
部分。尝试使用菜单 => View => Show symbol => Show end of line 查看该行您文件中的结尾。
怎么样:
查找内容:\R\h+
替换为:a space
其中 \R
代表任何类型的换行符,\h
代表任何类型的水平 space。