remove special characters from string javascript
var str = "Hello^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"var desired = stringToReplace.replace(/[^\w\s]/gi, '')//You can do it specifying the characters you want to remove:
string = string.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, '');
//Alternatively, to change all characters except numbers and letters, try:
string = string.replace(/[^a-zA-Z0-9]/g, '');const str = "abc's test#s";
console.log(str.replace(/[^a-zA-Z ]/g, " "));
Also in JavaScript:
- react select
- react select with custom option
- content type json
- javascript add alpha to hex
- https.get module in nodejs
- get date now javascript
- urlencode jquery
- unity rotate object to match normal
- adonis lucid join
- javascript modify href attr
- create an element jquery
- how to set up a success message show up if form is submitted in react hooks
- does string contain special charactors javascript
- javascript get first 2 char
- angular subscribe
- multiple case switch javascript
- column gap without affecting width site:stackoverflow.com
- how to check if item is in list js
- computed property name javascript
- alpine js
- add class javascript
- last element of an array javascript
- ladder physics javascript
- creating js objects