remove all non letters from string javascript code example
Example 1: remove non alphanumeric characters javascript
input.replace(/\W/g, '')
input.replace(/[^0-9a-z]/gi, '')
Example 2: javascript remove non numeric chars from string keep dot
var s = "-12345.50 €".replace(/[^\d.-]/g, '');
Example 3: js remove all non numeric from string
numString = myString.replace(/\D/g,'');
Example 4: remove non letters from a string javascript
function lettersOnly(str) {
return str.replace(/[^a-zA-Z]/g,"");
}
console.log(lettersOnly("R!=:~0o0./c&}9k`60=y"));
console.log(lettersOnly("^,]%4B|@56a![0{2m>b1&4i4"));
console.log(lettersOnly("^U)6$22>8p)."));