My split() is not working when there is a space before or after each line in my variable. The code below should return (123,45,67,89) but instead it returns (1234567,89). The REGEX is the problem, probably, but I don't know how to fix it. Your help will be appreciated. Thank you,
var keywordsArray = "1 2 3 \n4 5\n 6 7\n8 9";
keywordsArray = keywordsArray.replace(/\s\s+/g,' ').split('\n');
alert(keywordsArray);