How can I remove extra white space (i.e. more than one white space character in a row) from text in JavaScript?
E.g
match the start using.
Try this regex
var st = "hello world".replace(/\s/g,'');
or as a function
function removeSpace(str){ return str.replace(/\s/g,''); }
Here is a working demo