title: gsub replacing substring containing trailing space not working
body: <p>I have strings and would like to replace a pattern like <code>(+ 1)</code> (i.e. <code>space</code>, <code>opening bracket</code>, <code>1-3 digits</code>, <code>closing bracket</code>.</p>
  
  <p>for the string <code>str1 &lt;- "6 (+1010)"</code>, <code>str2 &lt;- "1 (+1)"</code>:</p>
  
  <pre><code>gsub("\\(\\+\\d{1,4}\\)", "", str1)
  &gt; "6 "
  gsub("\\(\\+\\d{1,4}\\)", "", str2)
  &gt; "1 "
  </code></pre>
  
  <p>This works fine but still contains the trailing space; trying to address this, I have tried the following <code>regex</code>s without success:</p>
  
  <ul>
  <li><code>gsub("\\(\\+\\d{1,4}\\) ", "", str1)</code>,</li>
  <li><code>gsub("\\(\\+\\d{1,4}\\)\\s", "", str1)</code>,</li>
  <li><code>gsub("\\(\\+\\d{1,4}\\)[[:space:]]", "", str1)</code>,</li>
  </ul>
  
  <p>They all yield <code>"6 (+1)"</code>. For now I am going with another, separate <code>gsub()</code> call but I'm sure there must be another, better way.</p>
  
  <p>I am expecting the output <code>6</code> (without trailing space).</p>