Reputation: 746
I have been using a regex replace to remove all punctuation from a text box value and replace the whitespaces left by the removal. It is working great except I have realized I need it to leave .
and ?
in the field. Here is what I am currently using. How can I skip those two characters but remove all others?
script
var special = special.replace(/[^\w\s]|_/g, "").replace(/\s+/g, " ");
Upvotes: 0
Views: 1189