fork download
  1. txt2 <- "useRs may fly into JFK or laGuardia"
  2. id <- 3
  3. sub(paste0("((?:\\w+\\W+){", id-1, "})(\\w)(\\w*)(\\w)"), "\\1\\U\\2\\E\\3\\U\\4", txt2, perl=TRUE)
  4.  
Success #stdin #stdout 0.24s 39148KB
stdin
Standard input is empty
stdout
[1] "useRs may FlY into JFK or laGuardia"