re = /<b.*?>(.*?)<\/b>/
str = 'Your <b class =\\"b_1\\">1</b> payment due is $4000.Your <b class =\\"b_1\\">2</b> payment due is $3500. Your <b class =\\"b_1\\">3</b> payment due is $5000.'
# 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