title: How to extract numbers from string containing numbers+characters into an array in Ruby?
body: <p>I have string that contains integers and characters and I need to extract all numbers in array, for example:</p>
  
  <pre><code>str = "achance123for84faramir3toshowhis98quality"
  #=&gt; [123, 84, 3, 98] #Desired output
  </code></pre>
  
  <p>I am having trouble grouping them together. I have tried:</p>
  
  <pre><code>str.split('').select {|el| el.match(/[\d]+.*/)}
  #=&gt; ["1", "2", "3", "8", "4", "3", "9", "8"]
  
  str.split('').select {|el| el.match(/[\d]+[\D]+/)}
  #=&gt; []
  </code></pre>
  
  <p>How can I maintain the grouping for all integers and list them in array? Assume it will contain <em>only</em> numbers and characters (a-z). No whitespace/ non-word characters. All will be lowercased.</p>
  
  <p><em>(they don't have to be converted to integer. I am just having problem coming up with the regex to separate them in groups. If there is a solution without Regex, that'd be awesome too!)</em></p>