var arr= []; "hell@o wor&ld".split(/(\W)/).forEach(function(elem) { if (!/^\s*$/.test(elem)) { arr.push(elem); } });