I'm trying to do this regex :
([A-Za-z]+\\s*?)+\\-+\\s+\\$[0-9.]+")
Searching for pattern like:
Text Text2- $566.767 Text3 Text4- $7886.765 ...continues
Here is the code I used:
data_out <- data[,unlist(lapply(col,function(x) {str_extract_all(x,"([A-Za-z]+\\s*?)+\\-+\\s+\\$[0-9.]+")})),id]
The above code works fine, but it takes very long to execute.
Is there any faster way to extract the above pattern?
Expected input and output shown in below screen shot :