javascript split string on space or on quotes to array - by Boriz var str = 'single words "fixed string of words"'; var astr = str.split(" "); // need fix i want the array to be like: single, words, fixed string of words. Read the article