import re
regex = re.compile(r"(?:.*?|\G)(\d\d\.\d\d\.(?:\d{4})?)|.*", flags=re.DOTALL)
test_str = ("BEGIN:VNOTE\n"
"VERSION:1.1\n"
"BODY;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:18.07.=0A14.08.=0A15.09.=0A15.10.=\n"
"=0A13.11.=0A13.12.=0A12.01.=0A03.02. Grippe=0A06.03.=0A04.04.2015=0A0=\n"
"5.05.2015=0A03.06.2015=0A03.07.2015=0A02.08.2015=0A30.08.2015=0A28.09=\n"
"17.11.2017=0A\n"
"DCREATED:20171118T095601\n"
"X-IRMC-LUID:150\n"
"END:VNOTE")
subst = "$1\\n"
result = regex.sub(subst, test_str)
if result:
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html