I want to extract the string after a number using RegEx in R. For example in this vector:
ex <- c("1112 - 6839 COLBORNE ST", "11 - 5552 FRONTENACK ST", "1430 WINDFIELD CRES LINE", "111 - 55502 FRONT ST SOUTH WEST")
The expected outcome should be:
COLBORNE, FRONTENACK, WINDFIELD, FRONT
I know that in Python this can be implemented through capturing groups but I was not able to do it in R or maybe there is an easier way to do it.
CodePudding user response:
library(stringr)
str_extract(ex, "[a-zA-Z] ")
[1] "COLBORNE" "FRONTENACK" "WINDFIELD" "FRONT"
