PmF111
PmF111

Reputation: 1

Regex to exclude dollar sign and dot in number

I'm using ParseHub to scrape some tables with currency numbers. Some of the values are:

I'm struggling to find a javascript regex that extracts these numbers, in a single group, in this format:

So basically I need to ignore dollar symbol and dot in thousands.

The regex ([-0-9\/|,]+) works well for everything, except $1.000,00 where it returns only 1

Thanks in advance for any help.

Upvotes: 0

Views: 865

Answers (1)

Jan
Jan

Reputation: 43169

Here is a JavaScript version:

let numbers = ['$1.000,00', '$800,64', '$100,00'];
numbers.forEach(function(number) {
    number = number.replace(/[$.]+/g, '');
    console.log(number);
});

Upvotes: 1

Related Questions