if (!String.prototype.trim) { //IE < 9 String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }; } var sssr = " 23 a 12 323 15 "; var arr = sssr.trim().split(/\s+/); //1 alert(arr) var arr = sssr.match(/\S+/g); //2 alert(arr)