Предположим, что у меня есть такой текст,
text<-c("[McCain]: We need tax policies that respect the wage earners and job creators. [Obama]: It harder to save. It harder to retire. [McCain]: The biggest problem with American healthcare system is that it costs too much. [Obama]: We will have a healthcare system, not a disease-care system. We have the chance to solve problems that we've been talking about... [Text on screen]: Senators McCain and Obama are talking about your healthcare and financial security. We need more than talk. [Obama]: ...year after year after year after year. [Announcer]: Call and make sure their talk turns into real solutions. AARP is responsible for the content of this advertising.")
и я хотел бы удалить (отредактировать: избавиться) весь текст между [и] (и самими скобками). Какой лучший способ сделать это? Вот моя слабая попытка с использованием регулярного выражения и пакета stingr:
str_extract(text, "\\[[a-z]*\\]")
Спасибо за любую помощь!