I\'m trying to parse the following kind of string:
[key:\"val\" key2:\"val2\"]
where there are arbitrary key:\"val\" pairs inside. I want t
Here's a one line solution without a while loop.
The order is preserved in the resulting list.
The potential downsides are
let re = /\s*([^[:]+):\"([^"]+)"/g
let str = '[description:"aoeu" uuid:"123sth"]'
(str.match(re) || []).map(e => RegExp(re.source, re.flags).exec(e))
[ [ 'description:"aoeu"',
'description',
'aoeu',
index: 0,
input: 'description:"aoeu"',
groups: undefined ],
[ ' uuid:"123sth"',
'uuid',
'123sth',
index: 0,
input: ' uuid:"123sth"',
groups: undefined ] ]