how to remove double spaces using regex code example
Example 1: replace multiple spaces with single space javascript
string = string.replace(/\s\s+/g, ' ');
Example 2: javascript replace multiple spaces with single space
var multiSpacesString="I have some big spaces.";
var singleSpacesString=multiSpacesString.replace(/ +/g, ' ');//"I have some big spaces."