I have this string
x = "Hello how are you Peter /"
And I would like to get only
x = "Peter"
I would like to find patter that extract only word after "you" and before "/" (exluded)
I would like to use something like
x = sub(" you*/.", "", x)
But I dont know how to make the pattern correctly.
>Solution :
library(stringr)
str_match(x, "you\\s*(.*?)\\s*\\/")[, 2]
#[1] "Peter"