akoumjian / datefinder

Find dates inside text using Python and get back datetime objects
http://datefinder.readthedocs.org/en/latest/
MIT License
634 stars 166 forks source link

Can't find specific dates in %d.%m.%Y format #179

Open skjerns opened 1 year ago

skjerns commented 1 year ago

list(datefinder.find_dates('07.11.2022_-_11.11.2022.pdf', first='day')) does not work, I don't understand why? Similar formats parse without problem

akoumjian commented 1 year ago

The separators there are causing a lot of problems. Because -_ can be used to separate date components themselves, the parser grabs the string greedily which in this case likely includes all of 07.11.2022_-_11.11.2022. Not sure what the immediate next steps would be, solving this likely includes breaking other valid examples.

skjerns commented 1 year ago

Okay thanks! I guess a workaround in my case would be to remove all underscores before calling the function