SyntaxFix
Write A Post
Hire A Developer
Questions
Just change + to -:
+
-
str = str.replace(/[^a-z0-9-]/g, "");
You can read it as:
[^ ]
[^a-z0-9-]
a-z
0-9
/ /g
More information: