Site: stackoverflow.com javascript remplacer plusieurs espaces par un seul espace
var multiSpacesString="I have some big spaces.";
var singleSpacesString=multiSpacesString.replace(/ +/g, ' ');//"I have some big spaces."
Grepper