title: Removing punctuation except for apostrophes AND intra-word dashes with gsub in R WITHOUT accidently concatenating two words
body: <p>I've been searching for an solution on Stackoverflow and experimenting in R (RStudio) for hours. I know how to remove punctuation while preserving apostrophes, intra-word dashes and intra-word &amp;'s (for AT&amp;T) with gsub (not with the tm package but I'd like to know if some one could offer a tip with regard to this operation in tandem with the following issue). I would like to know how to prevent concatenating the words with gsub, or any other regular expression procedure, where the punctuation that I removed once was. So far, this is the best I can do:</p>
  
  <pre><code>x &lt;-"Good luck!!!!SPRINT I like good deals. I can't lie brand-new stuff---- excites me got&amp;&amp;&amp;&amp;&amp; to say yo, At&amp;t why? a* dash-- apostrophe's''' I can do all-day. But preventing%%%%concatenating  is a new**$ballgame but----why--- not?"
  
  gsub("(\\w['&amp;-]\\w)|[[:punct:]]", "\\1", x, perl=TRUE) 
  
  #[1] "Good luckSPRINT I like good deals I can't lie brand-new stuff excites me got to say yo At&amp;t why a dash apostrophe's I can do all-day But preventingconcatenating  is a newballgame butwhy not"
  </code></pre>
  
  <p>Any idea's? The purpose of this question is to apply the solution to a data frame column or corpus of social media posts by the way.</p>