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