I have s string which looks something like
"USD $1,111.11"
Now i want this in the following format
"1111.11"
In short i want the letters "USD" , Dollar sign "$", and the "," sign removed
So if i do .replace('/^\D+/g','');
I get
"1,111.11"
And if i do .replace('/\D+/g','');
I get
"111111"
So how can i modify my regex(I think the 1st one is a bit closer to my desired output) to give me my desired output.
Just ignore both the numbers and the dot, like this
console.log("USD $1,111.11".replace(/[^.\d]/g, ""));
# 1111.11
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments