how to replace all special characters in javascript code example Example: js remove special characters var desired = stringToReplace.replace(/[^\w\s]/gi, '')