fork download
  1. library(stringr)
  2. vec <- c("time of the day", "word of the day", "time the day")
  3. str_replace_all(vec, "\\b(?<!\\bof\\s{1,100})the\\b", "of the")
  4. ## => [1] "time of the day" "word of the day" "time of the day"
  5.  
Success #stdin #stdout 0.32s 42504KB
stdin
Standard input is empty
stdout
[1] "time of the day" "word of the day" "time of the day"