在 Notepad++ regex 中匹配(并删除)LF 字符 [英] Match (and delete) LF character in Notepad++ regex

查看:66
本文介绍了在 Notepad++ regex 中匹配(并删除)LF 字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Notepadd++ 中,\r\n 正则表达式将找到所有 CRLF 组合.但是我有一些以 LF 结尾的行.首先,那是什么?接下来,我该如何匹配和删除它?\r\n 都不起作用.

In Notepadd++ the \r\n regex will find all the CRLF combinations. But I have some lines which end just with LFs. First of all, what is that that? Next, how can I match and delete just that? Neither \r or \n works.

推荐答案

LF 代表 'Line Feed'

LF stands for 'Line Feed'

您可以在 serverfault.se 上的这个答案 上阅读更多内容:

You can read some more on this answer on serverfault.se:

CR LF 的意思是回车,换行"——这是 DOS 的宿醉从某些设备需要回车的过去,以及某些设备需要换行才能换行,因此 Microsoft决定让一个新行同时包含两个字符,以便它们将在所有设备上正确输出.

CR LF means "Carriage Return, Line Feed" - it's a DOS hangover from the olden days from when some devices required a Carriage Return, and some devices required a Line Feed to get a new line, so Microsoft decided to just make a new-line have both characters, so that they would output correctly on all devices.

Windows 程序需要 CRLF 中的换行符格式 (\r\n).*尼克斯只需要 LF 数据(\n).如果您在记事本中打开 Unix 文本文档在 Windows 上,您会注意到所有换行符都消失了整个文档在一行上.那是因为记事本期望CRLF 数据,并且 Unix 文档没有 \r 字符.

Windows programs expect their newline format in CRLF (\r\n). *nix expect just LF data (\n). If you open a Unix text document in Notepad on windows, you'll notice that all of the line breaks dissapear and the entire document is on one line. That's because Notepad expects CRLF data, and the Unix document doesn't have the \r character.

有些应用程序可以在标准上为您转换*nix 发行版(dos2unix 和 unix2dos)

There are applications that will convert this for you on a standard *nix distro (dos2unix and unix2dos)

对于那些想知道的人来说,回车和换行不同于回到打字机时代,当回车和换行两个不同的东西.一个人会带你到队伍的开头(Carriage Return) 和 one 会将您向下移动一行,但在相同的水平位置(换行)

因此,您应该可以将其替换为 \n.

Thus, you should be able to replace it with \n.

这篇关于在 Notepad++ regex 中匹配(并删除)LF 字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆