remove special characters from the string js code example Example: js remove special characters var desired = stringToReplace.replace(/[^\w\s]/gi, '')