Possible Duplicate:
Split a string by spaces — preserving quoted substrings — in Python
Given the following string:
term1 term2 "the second term has spaces" term3 bad term 4
What regex will give me this list:
["term1", "term2", "the second term has spaces", "term3", "bad", "term", "4"]