I have a collection of data in the following format:
100 grams skinless chicken breasts 1 dl milk 2 cups granulated sugar
The pattern is always the same. First a number, then an empty space, then a string (the unit), another empty space followed by an unknown amount of words.
I would need to split this data into arrays like this:
[100,grams,skinless chicken breasts] [1,dl,milk] [2,cups,granulated sugar]
I’m having a hard time with this since I only want to split by an empty space after the two first spaces (the spaces after the number and after the unit). After that I need to retain the spaces (ingredient names can be multi-word). How could I split a string like this?