I have string such as 12 3 44 5 \n 7 88
I want get from string only numbers and write them in array: [12,3,4,5,7,88]
.
I want do it whith RegExp:
var str='12 3 44 5 \n 7 88';
alert(str);
var re =/^\S+$/;
var res=re.exec(str);
alert(res[0]);
alert(res[1]);
alert(res[2]);
But it doesn't work for me.