我有以下的文本文件:正则表达式 - 如何不匹配两个换行符
#Beginning of the file
aaa
bbbb
ccc
dddd
eee
ffff
ggggg
hhhsasas
dsdsd
#end of file
如何匹配这个文件从文本的每一段开头的空行从本节开始的一部分文本部分的结尾(下一节之间没有新行)?因此,使用上面的例子,我想拿到3场比赛:
#Beginning of the first match
aaa
bbbb
ccc
#End of first match
#Beginning of the second match
dddd
eee
ffff
#End of second match
#Beginning of the third match
ggggg
hhhsasas
dsdsd
#End of third match
我已经试过这样的事情:
(\n\n)[^(\n\n)]*
,但它不工作,我想,是因为^(\ n \ n)不会被视为组,而是单独的符号,因此它会匹配第一行的结尾。
会换行(在Windows上)不'\ r \ N' ? – AutomatedChaos
你正在使用哪个正则表达式平台? Javascript,PERL,.Net? – Gusdor
你想保持换行吗?或者只有拥有一群孤独的人,你会高兴吗? – Bohemian