我的日志模式如下:
2018-06-08 11:32:06 INFO 1 Global.asax - Service Starting
2018-06-08 11:33:06 INFO 1 Blah Blah Blah Blah
Blah Blah Blah
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
2018-06-08 11:34:06 INFO 1 yyyyyyyyyyyyyyyyyy
我想用正则表达式提取以下结果:
2018-06-08 11:32:06 INFO 1 Global.asax - Service Starting
和
2018-06-08 11:33:06 INFO 1 Blah Blah Blah Blah
Blah Blah Blah
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
和
2018-06-08 11:34:06 INFO 1 yyyyyyyyyyyyyyyyyy
这是我迄今为止尝试过的最接近的结果
(\d{4})[\D](\d{2})[\D](\d{2})[\s](\d{2})(\D)(\d{2})(\D)(\d{2}).*+
答案 0 :(得分:0)
哦,我很接近,这就是答案。
(\ d {4})\ D \ D \ s(\ D)(\ d {2})(\ D)(\ d {2})[\ s \ S] +?( ?=(\ d {4})\ d \ d \ S(\ d)(\ d {2})(\ d)(\ d {2})| \ Z)德尔>
感谢Toto的更新
\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}[\s\S]+?(?=\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}|\Z)