Lets say I have a line containing arguments splitted with ,
'0xe1b04048, FUTEX_WAIT, 0, NULL , "Hey, World, how, are, you"'
I want regex in python that splits this sequence into list containing items (for clarity split one item by line)
[
'0xe1b04048',
'FUTEX_WAIT',
'0',
'NULL',
'"Hey, World, how, are, you"'
]
I have tried to make regex with negative lookahead, what can at least process one comma in comment and my plan was to extend it but I didnt managed to do even that.
Calling
re.split(r",\s(?!\".*,\s.*\")",args)
on
'0xe1b04048, FUTEX_WAIT, 0, NULL , "Hey, World"'
results in
[
'0xe1b04048',
'FUTEX_WAIT',
'0',
'NULL , "Hey',
'World"'
]