Possible Duplicate:
Regular Expression to split on spaces unless in quotes
I need to split a specified string at all spaces in order to get arguments, however, I need all the text inside quotes to stay "un-split". For example:
ab "c d"
This needs to be split into 2 strings: 1. ab, 2. "c d". I attempted to use regex or write my own method to parse it, but had no luck.