我有多个带有LDAP条目的日志文件,我试图只匹配在特定日期具有createtimestamp的条目,但要捕获整个条目,而不仅仅是时间戳。条目如下:dn: ....otherattr: ...createtimestamp: 20130621061525Z问题是我也得到了我想要的条目之前的所有条目。dn: ....otherattr: ...createtimestamp: 20121221082545Zdn: ....otherattr: ...createtimestamp: 20130621061525Z这是表达式:dn_search = re.compile(r'dn: (.*?)createtimestamp: 20130[4-6]\d+?Z', flags=re.M|re.S)我尝试了其他一些表达式,但是我只获得了createtimestamp或不需要的条目。有任何想法吗?
添加回答
举报
0/150
提交
取消