Given a string like:
\"The dog has a long tail, and it is RED!\"
What kind of jQuery or JavaScript magic can be used to keep spaces to only o
var string = "The dog has a long tail, and it is RED!"; var replaced = string.replace(/ +/g, " ");
Or if you also want to replace tabs:
var replaced = string.replace(/\s+/g, " ");