title: Read only numbers from a string
body: <p>I seen Q&amp;A like <a href="https://stackoverflow.com/questions/1588058/read-two-variables-in-a-single-line-with-python">this</a> and <a href="https://stackoverflow.com/questions/17336943/removing-non-numeric-characters-from-a-string">this</a> but I still have a problem.</p>
  
  <p>What I want is to get a string that might contain non-digits characters, and I want to only extract 2 numbers from that string. So, if my string is <code>12 ds  d21a</code> I want to extract <code>['12', '21']</code>.</p>
  
  <p>I tried using:</p>
  
  <pre><code>import re
  non_decimal = re.compile(r'[^\d.]+')
  non_decimal.sub("",input())
  </code></pre>
  
  <p>and fed this string <code>12 123124kjsv dsaf31rn</code>. The result was <code>12123124</code> which is nice, but I want the non-digit characters to separate the numbers.</p>
  
  <p>Next I tried to add <code>split</code> - <code>non_decimal.sub("",input().split())</code>. Didn't help.</p>
  
  <p>How can I do that (assuming there is way that does not include scanning the whole string, iterating over it and extracting the digits "manually")?</p>
  
  <p>For more clarification, <a href="https://stackoverflow.com/a/22984026/3512538">this</a> is what I want to achieve, in C.</p>