remove special characters from string javascript
snippet in javascript

remove special characters from string javascript

user818

var str = "Hello^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"

js remove special characters

user1714

var desired = stringToReplace.replace(/[^\w\s]/gi, '')

remove all sign that is not a-b in string js

user9566

const str = "abc's test#s";
console.log(str.replace(/[^a-zA-Z ]/g, " "));