remove a special character from string javascript
var str = "Hello^# World/";
str.replace(/[^a-zA-Z ]/g, ""); // "Hello World"//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:
- .map function
- angularjs 1.5.6 cdn
- full screen a div
- if condition in class angular 8
- () = javascript
- function click anywhere javascript
- javascript format date time
- arrow function javascript
- How to access the request body when POSTing using Node.js and Express
- js know size of screen
- nextjs router get complete url
- javascript detect escape key pressed
- anagram javascript example
- difference between == and === in javascript
- what data type is a {} i njs
- prime factorization javascript
- express get request origin
- do i have to include jquery files at head of bootstrap
- tranary operator in js
- discord.js tagging the author
- how to get selected row index of table in javascript
- between in mongodb
- import all from javascript
- move navbar items to right with reactbootstrap