title: Scanning an array of strings for matches in Ruby
body: <p>I have an array of string and I want to search for a certain words (cat or dog) in each string within the array and be able to view the results in the order they came. </p>
  
  <p>Example sentences </p>
  
  <pre><code>Strings[0] = "Subject family leans toward cats" 
  Strings[1] = "Test subject prefers dogs"
  </code></pre>
  
  <p>I tried <code>String.each {|x| x.scan(/cat|dog)/ }</code> but I would only ever get the last match in the results. how might I do this correctly to get <code>puts $1 =&gt; cat  puts $2 =&gt; dog</code>? Thank you for your assistance</p>