fork download
  1. x <- "\nMr. Johnson (spoke in \nRussian) (United Kingdom and \nNortheren Ireland) \n"
  2. gr <- gregexpr("\\([^()]*\\)", x)
  3. mat <- regmatches(x, gr)
  4. regmatches(x, gr) <- lapply(mat, function(z) sub("\n", "", z, fixed=TRUE))
  5. x
Success #stdin #stdout 0.21s 39656KB
stdin
Standard input is empty
stdout
[1] "\nMr. Johnson (spoke in Russian) (United Kingdom and Northeren Ireland) \n"