fork download
  1. import re
  2. msg='He was paid USD 2,000.00 & USD 500 on 19-02-2018 at 08:15:24.'
  3. rx = r'USD\s*(\d{1,3}(?:,\d{3})*(?:\.\d+)?)'
  4. res = [int(float(x.replace(',',''))) for x in re.findall(rx, msg)]
  5. print(res)
Success #stdin #stdout 0.04s 27712KB
stdin
Standard input is empty
stdout
[2000, 500]