regex replace special characters js code example
Example 1: regex special characters javascript
var regex = /^[a-zA-Z0-9!@#\$%\^\&*\)\(+=._-]+$/g
Example 2: js remove special characters
var desired = stringToReplace.replace(/[^\w\s]/gi, '')
var regex = /^[a-zA-Z0-9!@#\$%\^\&*\)\(+=._-]+$/g
var desired = stringToReplace.replace(/[^\w\s]/gi, '')