i want remove all ‘,’ from my string with regex in javascript.
this is an example from my string:
45,454,545
and i want my string convert to this:
45454545
Answer
Comma isn’t a special character in regex, so you can just use /,/
. Add the global flag and you’re done.
console.log('45,454,545'.replace(/,/g, ''))