Given that you also want to cover tabs, newlines, etc, just replace ss+
with ' '
:
string = string.replace(/ss+/g, ' ');
If you really want to cover only spaces (and thus not tabs, newlines, etc), do so:
string = string.replace(/ +/g, ' ');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…