# Many right answers but in case you want it in a float, directly, without using regex:
x= '$123.45M'
float(''.join(c for c in x if (c.isdigit() or c =='.'))
#You can change the point for a comma depending on your needs.
#change for this if you know your number is an integer
x='$1123'
int(''.join(c for c in x if c.isdigit())