title: How to extract the last digits of strings using regular expressions?
body: <p>I have a bunch of colnames</p>
  
  <pre><code>L_1_3
  L_2_23
  L_3_91
  L_3_16
  </code></pre>
  
  <p>I want to replace these colnames with new names using the last digits following the _ like this: </p>
  
  <pre><code>3
  23
  91
  16
  </code></pre>
  
  <p>I've tried <code>colnames(X) &lt;- gsub("L_\\d\\d_", "", colnames(X))</code> which works for strings with double digits at the end. I want one that works for both single and double digits. </p>
  
  <p>Thank you!</p>