In google sheets I would like to be able to extract dates from a text cell. I found a solution in RegEx get last match of a date format from string inside a Google Sheets cell but it doesn't take into account that my dates are not formatted equally. They might have 1 or 2 digits for the day, then 1 or 2 for the month and 2 or 4 for the year.
I have adapted the solution from above to look for multple digits using d{1, }:
"(?:.+)(\d{1,}-\d{1,}-\d{2,})"
but if the day has 2 digits the first digit falls off
"1-8-2018 en 1-2-2019" results in -> 1-2-2019
"26-3-19 en 23-4-2019" results in -> 3-4-2019
"1-1-20 of 8-2-20 en dan 12-10-20" -> 2-10-20<>
It seems to work fine for month and year but not for the day, how do I solve this?
Bonus question: Mostly there are 2 dates in the cell sometimes 3 maybe more in future. I would like to be able to select which of the dates is returned. It is now selectingt the last date. Is there a way to count the number of matches from the beginning and then choose one?