Suppose I have some text like this,
text<-c(\"[McCain]: We need tax policies that respect the wage earners and job creators. [Obama]: It\'s harder to save
The following should do the trick. The ? forces a lazy match, which matches as few . as possible before the subsequent ].
?
.
]
gsub('\\[.*?\\]', '', text)