I have many strings referring to monetary values, such as $15K, USD20M, €1.8k , etc
Now I need to extract the number and the multiplier (K,k, M or m) in order to process the data.
I came up with the following regex:
[\${1}|€{1}][0-9]+(?:\.[0-9]*)?[M|K|k|m]
But I’m not sure how to extract each of the subparts of the expression and return them back to my Python code as variables, so for $15K, I would want:
currency='$'
ammount=15
multiplier='K'
Any ideas?
Like this?
Not like it’s really necessary in Python, though, when you can just do
or even simpler