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
With this:
gsub("\\[[^\\]]*\\]", "", subject, perl=TRUE);
What the regex means:
\[ # '[' [^\]]* # any character except: '\]' (0 or more # times (matching the most amount possible)) \] # ']'