1var str = "Hello^# World/";
2str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"
1//You can do it specifying the characters you want to remove:
2string = string.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, '');
3//Alternatively, to change all characters except numbers and letters, try:
4string = string.replace(/[^a-zA-Z0-9]/g, '');
1var desired = stringToReplace.replace(/[^\w\s]/gi, '')
2
3//if you are using non english like arabic and other language
4var outString = sourceString.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');