var desired = stringToReplace.replace(/[^ws]/gi, '') //if you are using non english like arabic and other language var outString = sourceString.replace(/[`~!@#$%^&*()_|+-=?;:'",.<>{}[]/]/gi, '');