I have some data in a string in the format key: value key: value key: value etc...
I'm trying to turn it into an array using a regex match. The keys are all uppercase letters directly followed by a colon. Then there is a space and the value starts. This is then followed by a space and then the next key. The value can contain upper/lowercase letters, numbers, space, comma or equals sign.
For example, I'd like this input string:
NAME: Name of Item COLOR: green SIZE: 40
Turned into this array:
newArray[NAME] = Name of Item
newArray[COLOR] = green
newArray[SIZE] = 40
Any help is much appreciated. Also I don't have access to the formatting of the input, or I'd make this a lot easier on myself.