I need to replace all chars which are not match with range a-zA-Z_-0-9. So I do val.replace(/[^a-zA-Z_-0-9]/g, \'\') but get error. How can I bit t
a-zA-Z_-0-9
val.replace(/[^a-zA-Z_-0-9]/g, \'\')
You have a bad range, remove the - between _ and the number range and put it at the end or at the beginning.
-
_