Home » technology »

JavaScript - Replace multiple characters from a string

Submitted by Vidhu on Feb 25 2018 Views: 425 | 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

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

Leave a comment!