title: Remove text outside of brackets in R
body: <p>So I have a set of text like below that has brackets around all the named entities, I want to remove the text outside of the brackets and keep all the punctuation. Any thoughts?</p>
  
  <pre><code>Sample_Text &lt;- "[PERSON Meredith Vieira] will become the first woman to host [MISC Olympics] primetime coverage on her own when she fills on Friday night for the ailing [PERSON Bob Costas] , who is battling a continuing eye infection. " It 's an honor to fill in for him , " [PERSON Vieira] said on TODAY Friday ."
  </code></pre>
  
  <p>Ideally I would end up with this vector below.</p>
  
  <pre><code>Entities &lt;- ([PERSON Meredith Vieira] [MISC Olympics] [PERSON Bob Costas]. [PERSON Vieira].)
  </code></pre>
  
  <p>My first attempt was to grep out the text between two brackets but I wasn't getting the text and my REGEX wasn't working properly. Then I realized I need the punctuation. Here is my REGEX attempt below. Thoughts?</p>
  
  <pre><code>grep("\\[.*?\\]", "", d, perl=TRUE)
  </code></pre>