re = /\b\d{1,3}(?:,\d{2,3})*(?:,\d{3})*(?:\.\d+)?\b/
str = 'problem satatement is to get all the amount despite of inconsistencies in comma or dollar sign also I need to exclude year from that (if no pattern can be made asssume to get all the amount greater than 3000)
$ 1,000,000.6522
$ 3,500,000
90,00,00,000
5000000
200
200,000
20,00,000
1,000
$ 4,000,000 for the 2023
800,000
90.65
5,555
5000
2021 --------this should be excluded from the pattern
89jfe90ABI900 ----this also should be excluded from the pattern'
# Print the match result
str.match(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