-3

'US $109.90/ea' should become '109.90'

1 Answers1

1

You can replace all characters except number and dot with empty string:

var str = 'US $109.90/ea';
var number = str.replace(/[^\d.]+/g, '');
console.log(number);
Mamun
  • 66,969
  • 9
  • 47
  • 59
  • 1
    No alternation needed. Add `+` quantifier to make it more efficient (like I have in my comment below the question) – ctwheels Nov 20 '19 at 00:02