Regular expression for numbers, commas and periods

1

I need to get a specific content from a string that is returned in javascript.

I thought about getting his match with regular expression to get exactly the numbers, points and commas of the monetary return that has in part of the text, the problem is that the letters also come in the return.

For example, I have the phrase "Total Estimated Effective: R $ 209,502.84"

I wanted to get only 209,502.84

I've been in

var total = $(".totalEstimadoVigente").html().match("(?:\.|,|[0-9])*").join('');

How to solve this ER?

    
asked by anonymous 16.04.2018 / 16:28

1 answer

2

Try the following expression: [\d\.\,]+

In your code:

var total = $(".totalEstimadoVigente").html().match(/[\d\.\,]+/g).join('');

The return value with the String Total Estimado Vigente: R$ 209.502,84 will be:

209.502,84
    
16.04.2018 / 16:37