Javascript remove all ‘,’ in a string with regex [closed] Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Javascript remove all ‘,’ in a string with regex [closed] without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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, ''))
We are here to answer your question about Javascript remove all ‘,’ in a string with regex [closed] - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji