python 3.x compatibility: fix replacement string (may fail with errors like `bad escape \d ...`, etc)

pull/2038/head
sebres 7 years ago
parent 442b0b1c59
commit 3e8098d427

@ -204,7 +204,7 @@ class DateEpoch(DateTemplate):
self.name = "LongEpoch";
epochRE = r"\d{10,11}(?:\d{3}(?:\d{3})?)?"
if pattern:
regex = RE_EPOCH_PATTERN.sub("(%s)" % epochRE, pattern)
regex = RE_EPOCH_PATTERN.sub(lambda v: "(%s)" % epochRE, pattern)
self.setRegex(regex)
elif not lineBeginOnly:
regex = r"((?:^|(?P<square>(?<=^\[))|(?P<selinux>(?<=\baudit\()))%s)(?:(?(selinux)(?=:\d+\)))|(?(square)(?=\])))" % epochRE

Loading…
Cancel
Save