I've got a character in R:
value <- "This is (delete) a (keep) test sentence."
I want to remove the first pair of parentheses with the text, but keep the second one. I tried to use a gsub()
:
value2 <- gsub("(delete)", " ", value)
The result is: "This is () a (keep) test sentence."
But what I need is: "This is a (keep) test sentence."
What can I do to reach this?