[Solved] How to find dates in any text with regex? [closed]


To begin with SDICA>31.04.2019END($> is not a valid date 🙂 April just has 30 days in a month.

But to answer your question, you can use dateutil module, especially the parser.parse function for the problem at hand

from dateutil import parser

#Parse date from the string, fuzzy parameter can find hidden datetime string around a wall of text
print(parser.parse('ASDICA>31.01.2019END($>', fuzzy=True))

The output will be 2019-01-31 00:00:00

9

solved How to find dates in any text with regex? [closed]