fork(1) download
  1. x <- c(
  2. "Welcome to A I: the best W O R L D!",
  3. "Hi I R is the B O M B for sure: we A G R E E indeed."
  4. )
  5. gsub("(?:(?=\\b(?:\\p{Lu}\\h+){2}\\p{Lu})|\\G(?!\\A))\\p{Lu}\\K\\h+(?=\\p{Lu})", "", x, perl=TRUE)
Success #stdin #stdout 0.33s 175424KB
stdin
Standard input is empty
stdout
[1] "Welcome to A I: the best WORLD!"              
[2] "Hi I R is the BOMB for sure: we AGREE indeed."