fork(1) download
  1. import re
  2. s = """I want a (hot chocolate)[food] and (two)[quantity] boxes of (crispy bacon)[food]"""
  3. print(re.split(r'\s(?!\w+\))',s))
  4.  
  5.  
Success #stdin #stdout 0.03s 9248KB
stdin
Standard input is empty
stdout
['I', 'want', 'a', '(hot chocolate)[food]', 'and', '(two)[quantity]', 'boxes', 'of', '(crispy bacon)[food]']