So I've used this answer to get really close to what i need.
In my case I want to split on space but not when a part of the string is within quotes.
This is my code:
data = '"abc dfg" ab da'
PATTERN = re.compile(r'''((?:[^ "']|"[^"]*"|'[^']*')+)''')
wordList = PATTERN.split(data)[1::2]
Gives wordList:
['"abc dfg"', 'ab', 'da']
How can I change the expression so that the string is without the extra quotes?
Like this:
['abc dfg', 'ab', 'da']