fork download
  1. library(stringr)
  2. a <- "test:e[xample\\"
  3. str_replace_all(a, "[/\\\\?*:\\[\\]]", "_")
  4. gsub("[][/\\?*:]", "_", a)
  5. gsub("[][/\\\\?*:]", "_", a, perl=TRUE)
Success #stdin #stdout 0.29s 42972KB
stdin
Standard input is empty
stdout
[1] "test_e_xample_"
[1] "test_e_xample_"
[1] "test_e_xample_"