How to extract float numbers from a string in ruby?
regex, ruby
Solution
You can use this regex to match floating point numbers in the two formats you posted: -
(\d+[,.]\d+)
See Demo on Rubular
Problem
I have string with an amount different currencies in it, e.g, ``` "454,54$", "Rs566.33", "discount 88,0$" etc. ``` The pattern is not consistent and I want to extract only float numbers from the string and the currency. How I can achieve this in Ruby ?