fork(2) download
  1. vals = ['$10000.00', '10000.00', '$(10000)', '$10,000', '$(10,000)', '-$10,000']
  2. # 10000.00 10000.00 -10000 10000 -10000 -10000
  3. puts vals.map { |m| m.sub(/\A(.*?)\(([^()]*)\)/, '-\1\2').gsub(/[^0-9.-]+/, '') }
Success #stdin #stdout 0.01s 6392KB
stdin
Standard input is empty
stdout
10000.00
10000.00
-10000
10000
-10000
-10000