I would like to extract date from the following list of text:
[[1]] [1] \"TAX INVOICE 28 Dec 2018 PO2222\" [[2]] [1] \"TAX INVOICE 20 Nov 2018
Here is a base R option using lapply and gsub:
lapply
gsub
lst <- list("TAX INVOICE 28 Dec 2018 PO2222", "TAX INVOICE 20 Nov 2018 PO11111") lapply(lst, function(x) gsub(".*(\\d{2} \\w{3} \\d{4}).*", "\\1", x)) [[1]] [1] "28 Dec 2018" [[2]] [1] "20 Nov 2018"
Demo