library(stringr)a <- "test:e[xample\\"str_replace_all(a, "[/\\\\?*:\\[\\]]", "_")gsub("[][/\\?*:]", "_", a)gsub("[][/\\\\?*:]", "_", a, perl=TRUE)
Standard input is empty
[1] "test_e_xample_" [1] "test_e_xample_" [1] "test_e_xample_"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!