I am trying to extract the date from a string of text, and I have been able to extract the dates in the format "m/dd/yyyy" (i.e. January to September), but my code doesn't seem to work for the "mm/dd/yyyy" format (i.e. October to December) - see code below. It appears as 02/27/2019 when it needs to appear as 12/27/2019. Anyone know how I can get a code to work for all months?
string <- "20 French From home 12/27/2019"
gsub( ".*(\\d{1,2}/\\d{1,2}/\\d{4}).*", "\\1", string)