为什么Atom找不到这些换行符? [英] Why can't Atom find these newlines?
问题描述
我正在尝试清理一堆包含换行符且无法让Atom查找换行符的.vcf
文件.如果选择"regex",通常\r
,\n
或\r\n
都可以工作,但在这种情况下根本找不到空白行.这是一个选择:
I'm trying to clean up a bunch of .vcf
files that have line breaks in them and having trouble getting Atom to find the line breaks. Usually either \r
, \n
or \r\n
will work if "regex" is selected but in this case it isn't finding blank lines at all. Here's a selection:
BEGIN:VCARD VERSION:3.0
X-UNKNOWN-ELEMENT;TYPE=objectclass:top
X-UNKNOWN-ELEMENT;TYPE=objectclass:person
X-UNKNOWN-ELEMENT;TYPE=objectclass:organizationalPerson
X-UNKNOWN-ELEMENT;TYPE=objectclass:inetOrgPerson
X-UNKNOWN-ELEMENT;TYPE=objectclass:mozillaAbPersonAlpha
我阅读了此如何在Atom中替换换行符? ,但那里的解决方案都没有帮助我找到空白行.
I read over this How do I replace a newline in Atom? but none of the solutions there helped me find empty lines.
我结束了转向bash的工作,以摆脱空白:sed -i '/^$/d' *.vcf
,但是我还有很多其他事情要清理.像这样的东西:
I wound up moving to bash to get rid of empty lines: sed -i '/^$/d' *.vcf
but there are a bunch of other things I'd like to clean up. Stuff like:
X-UNKNOWN-ELEMENT;TYPE=E-mail 2 - Type:internet
X-UNKNOWN-ELEMENT;TYPE=E-mail 2 - Value:person@example.com
应该成为:
EMAIL;TYPE=WORK:person@example.com
那只是一个例子.还有其他一些,它们都围绕匹配多行字符串,这是我以前从未遇到过的问题,但是在这种情况下,如果我使用项目搜索,就找不到字符串了.
That is just one example. There are others, they all revolve around matching multi-line strings, something I've never had a problem with before but in this case it just isn't finding the strings if I use the project search.
推荐答案
感叹.
答案是:因为Atom项目搜索不支持多行搜索,所以正则表达式还是不支持:
The answer is: because Atom project search doesn't support multi-line searches, reg-ex or no:
https://github.com/atom/find-and-replace/issues/218
这篇关于为什么Atom找不到这些换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!