title: How to extract digits from string and return the last 3 or less using regex
body: <p>Consider the string <code>s</code></p>
  
  <pre><code>s = 'hello1 my45-fr1@nd5'
  </code></pre>
  
  <p>I want to strip out the last 3 digits <code>'515'</code>.  I know I can do</p>
  
  <pre><code>import re
  
  re.sub(r'\D', '', s)[-3:]
  
  '515'
  </code></pre>
  
  <p>However, I need a single regex substitution that performs the same task.</p>