re = /\bDebit\s*\d*\s+([0-9,.]*)/m
str = 'Hello,
Please release.
Please find below the retail cash forecast that will be drafted xx/xx/xxxx.
RUN ID No. Amount Curr.
xxxxx - Direct Debit 13 10,706,855.69 USD
xxxxx - Direct Credit 213122 (10,365,481.96) USD
TOTAL 341,373.73 USD
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html