text100 <- "My ### is 1234"gsub("(?<!\\w)\\#+(?!\\w)","hash",text100, perl=T)
Standard input is empty
[1] "My hash is 1234"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!