x <- c("This (is solved", "This is (fine)", "This is the problem)")gsub("(\\([^()]*\\))|[()]", "\\1", x)
Standard input is empty
[1] "This is solved" "This is (fine)" "This is the problem"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!