I am sure this is a very simple question. In the meantime, I am very familiar with RegEx in R, but I just can't get around this topic.
Suppose we have this line:
a <- c("ab . ) ] \"")
Now all I want to do is remove the quotation marks, the dot closing the brackets, and the closing brackets.
So I want: "ab" .
I tried:
gsub("[.\\)\"\\]]", "", a)
This does not work. It returns: "ab . ) ]" So nothing is deleted.
As soon as I exclude \\] from the search pattern, it works ...
gsub("[.\\)\"]", "", a)
But of course, he does not remove the closing brackets!
What I did wrong?!?
Thank you for your help!
swolf source share