Welcome to Ebugg-i.com

Thanks for coming to Ebugg-i.com.

Ad blocker detected


Our website is made possible by displaying online advertisements to our visitors. We need to pay our bills (hosting charges) and we can't do that for free. Please consider supporting us by disabling your ad blocker on our website and whitelist our website.
Please disable ad blocker and reload this web page
Close this message
Home » technology » Howto

JavaScript - Replace multiple characters from a string

Submitted by Vidhu on Feb 25 2018 Views: 645 | Subscribe

Is there anyway to replace multiple characters using the Replace() method ?

Example 1:
var string = '_how_do-you_do';
string.replace(/-|_/g,'');

Example 2:
var string = '#_how_do-#you_do';
string.replace(/[#_]/g,'')


Tags: Javascript, Jquery, replace character
Bitdefender Antivirus for Mac and PC

Get email updates. Virus Removal Tips, News, How to, Threat Alerts.

Leave a comment!