Why can't Atom find these newlines?

大城市里の小女人 提交于 2019-12-11 07:39:09

问题


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

I read over this How do I replace a newline in Atom? but none of the solutions there helped me find empty lines.

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

Which should become:

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.


回答1:


Sigh.

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



来源:https://stackoverflow.com/questions/47913351/why-cant-atom-find-these-newlines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!