I have a string and I want to turn it into an array by splitting it into individual elements. For example:
let str = "add 2017-04-25 2 USD Jogurt"
str.split(" ");
["add", "2017-04-25", "2", "USD", "Jogurt"]
But how can I combine two words into one element to achieve this format?
add 2017-04-25 3 EUR “French fries”
["add", "2017-04-25", "3", "EUR", "French fries"]
I have heard that regular expressions can be used for this purpose, but I am not sure how to implement it. Perhaps by splitting with another delimiter in the command: add 2017-04-25 3 EUR “French fries”