uses \d to match any digit, and the + that follows \d makes \d match as many digits in a row as possible.
"The car costs $1000 and the cat costs $10".scan(/\d/) do |x| puts x end