Q: Split a sentence based off two conditions if the input is given as follows:
abc "def abc" mno pqr "est mnr"

the output should be as follows:
abc 
def abc
mno
pqr
est mnr


A: Here is a Python option using re.findall:
inp = 'abc "def abc" mno pqr "est mnr"'
parts = re.findall(r'(?<!\S)".*?"(?!\S)|\b\w+\b', inp)
parts = map(lambda x : re.sub(r'"(.*)"', '\\1', x), parts)
print(parts)

This prints:
['abc', 'def abc', 'mno', 'pqr', 'est mnr']

Note that the second map step is required to remove double quotes, from those matches which were quoted terms.
