是否有正则表达式删除除单词之间的所有空格.
所以
" Hello. How are you today? "
会成为
"Hello. How are you today?"
" Hello. How are you today? ".replace(/\s{2,}/g,' ').trim()
小提琴:http://jsfiddle.net/REAdV/