if you wish to use a custom made function instead of regex than here is the code did not test for performance against regex.
input string = 'add 2017-04-25 3 EUR "French crispy fries" and "tasty burger"'
output array = ["add", "2017-04-25", "3", "EUR", "French crispy fries", "and", "tasty burger"]
function myFunction() {
var str = 'add 2017-04-25 3 EUR "French crispy fries" and "tasty burger"';
var result = str.split(" ");
var resultString = [];
var quotedString = [];
var ignoreSplit = '"';
push = 0;
for(var i=0;i<result.length;i++)
{
//start pushing if you found double quotes on starting
if(result[i].indexOf(ignoreSplit)==0)
{
push = 1;
//replace double quotes to nothing and push
quotedString.push(result[i].replace(ignoreSplit,''));
}
//push if double quotes found in end
else if(result[i].indexOf(ignoreSplit)>0)
{
//stop the push in between
push = 0;
quotedString.push(result[i].replace(ignoreSplit,''));
//push the quoted string in main result string
resultString.push(quotedString.join(' '));
//empty quoted string to be used again
quotedString = [];
}
//push if between the double quotes area
else if(push == 1)
{
quotedString.push(result[i]);
}
//push in the main result string normal case
else
{
resultString.push(result[i]);
}
}
console.log('final ',resultString);
}