I am trying to use regex replace with a regex I have. When I use the match method it returns the array with the proper index and match but when I use replace and add the replace string it wouldnt work.
var a = "$#,##0.00".match("[\\d+-,#;()\\.]+");
console.log(a);
Returns ["#,##0.00", index: 1, input: "$#,##0.00"].
var b = "$#,##0.00".replace("[\\d+-,#;()\\.]+","");
console.log(b);
Returns $#,##0.00 whereas I expect it to return just the $
Can someone point out what am I doing incorrectly? Thanks Link to the example is:
var a = "$#,##0.00".match("[\\d+-,#;()\\.]+");
console.log(a);
var b = "$#,##0.00".replace("[\\d+-,#;()\\.]+","");
console.log(b);
replace()?