Im trying to extract dates from a text string. So far I have had some progress with the anydate. My idea is to extract all dates within a text string,to a string separated by a comma, like this:
str1 = "08/07/2022 FC 08/15/2022 yusubclavio derecho"
paste0(anydate(str_extract_all(str1, "[[:alnum:]]+[ /]\\d{2}[ /]\\d{4}")[[1]]), collapse = ", ")
[1] "2022-08-07, 2022-08-15"
My problems start when date format is DD/MM/YYYY.
str1 = "22/08/2022 FC yusubclavio derecho"
paste0(anydate(str_extract_all(str1, "[[:alnum:]]+[ /]\\d{2}[ /]\\d{4}")[[1]]), collapse = ", ")
[1] ""