title: Extract number from string in Ruby
body: <p>I'm using this code:</p>
  
  <pre><code>s = line.match( /ABCD(\d{4})/ ).values_at( 1 )[0] 
  </code></pre>
  
  <p>To extract numbers from strings like:</p>
  
  <pre><code>ABCD1234
  ABCD1235
  ABCD1236
  </code></pre>
  
  <p>etc. </p>
  
  <p>It works, but I wonder what other alternative I have to to this in Ruby?</p>
  
  <p>My code:</p>
  
  <pre><code>ids = [] 
  someBigString.lines.each {|line|
     ids &lt;&lt; line.match( /ABCD(\d{4})/ ).values_at( 1 )[0] 
  }
  </code></pre>