title: Rename column names with gsub and sub
body: <p>I have been reading about renaming column names using gsub and sub. I want to take various column names 20220427_209944540823_SC835404_12.RCC and truncate to SC835404_12. What am I missing in my code. Currently, I am getting 209944540823_SC835404_12</p>
  <pre><code>colnames(expr_counts) &lt;- gsub(c(&quot;.RCC&quot;), &quot;&quot;, sub(&quot;^[^_]*_&quot;, &quot;&quot;, colnames(expr_counts)))
  </code></pre>