replace specific characters with space in javascript code example
Example 1: remove special characters from string javascript
var str = "Hello^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"
Example 2: js replace all spaces
var replaced = str.replace(/ /g, '_');