1
I need to take a specific content of a string that is returned in javascript.
I thought to take 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 comes in the return.
For example, I have the phrase "Total Current Estimate: R$ 209.502,84"
I just wanted to get 209,502.84
I arrived so far in
var total = $(".totalEstimadoVigente").html().match("(?:\.|,|[0-9])*").join('');
How to solve this ER?
Regular Expressions do not use quotes for definition. It is necessary to put
/
at the beginning and end.– bio
Beauty, perfectly bro, is perfect
– gabrielfalieri
Wouldn’t it be easier to use
+
instead of{1,}
?– Isac
@Isac for writing and reading yes, but it still works. As I was doing the tests I forgot this detail.
– bio