正则表达式:查找所有不带“”的换行符作为前一个字符
我有一个包含一堆数据的文件,如下所示:
"sc14b61ecf5ef162","sc14b61b07ba1690","1264806000","1264806000","780","1080","Navn arrangement:
Dørene åpner:
Arr.start:
Arr:slutt:
Dørene stenger:
HA (navn):
HA (tlf):
Type arrangement: (her: om konsert, gjerne sjanger)
Forvetet antall gjester:"
"sc14b61f9e35f569","sc14b61bf07647db","1265583600","1265583600","1020","1260","Nord/Sør
Foredrag
Ønsker skjenking"
这会重复多次(使用不同的数据)。我希望它看起来像这样:
"sc14b61ecf5ef162","sc14b61b07ba1690","1264806000","1264806000","780","1080","Navn arrangement:Dørene åpner:Arr.start:Arr:slutt:Dørene stenger:HA (navn):HA (tlf):Type arrangement: (her: om konsert, gjerne sjanger)Forvetet antall gjester:"
"sc14b61f9e35f569","sc14b61bf07647db","1265583600","1265583600","1020","1260","Nord/Sør Foredrag Ønsker skjenking"
我认为我需要的是某种方法来删除前面没有“的所有换行符,但我的正则表达式很弱。
我正在使用 Textwrangler (文本编辑器)对于 OS X)。
I have a file with a bunch of data looking like this:
"sc14b61ecf5ef162","sc14b61b07ba1690","1264806000","1264806000","780","1080","Navn arrangement:
Dørene åpner:
Arr.start:
Arr:slutt:
Dørene stenger:
HA (navn):
HA (tlf):
Type arrangement: (her: om konsert, gjerne sjanger)
Forvetet antall gjester:"
"sc14b61f9e35f569","sc14b61bf07647db","1265583600","1265583600","1020","1260","Nord/Sør
Foredrag
Ønsker skjenking"
This repeats itself many times (with different data). I would like it to look like this:
"sc14b61ecf5ef162","sc14b61b07ba1690","1264806000","1264806000","780","1080","Navn arrangement:Dørene åpner:Arr.start:Arr:slutt:Dørene stenger:HA (navn):HA (tlf):Type arrangement: (her: om konsert, gjerne sjanger)Forvetet antall gjester:"
"sc14b61f9e35f569","sc14b61bf07647db","1265583600","1265583600","1020","1260","Nord/Sør Foredrag Ønsker skjenking"
I think that what I need is some way to remove all line-breaks that does not have an " in front of it, but my regex is weak.
I'm using Textwrangler (the text editor for OS X).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这称为消极查找。这应该可以解决问题。
根据评论中的 @ax,在 Mac 上,您可能需要将
\n
更改为\r
,如下所示:如果仍然不起作用,有时您可能需要将两者结合起来:
其中之一应该可以满足您的需求。
This is called negative look behind. This should do the trick.
Per @ax in the comments, on a Mac, you may need to change the
\n
to\r
like so:If that still doesnt work, sometimes you may need to combine the two:
One of these should meet your needs.