I need to support exact phrases (enclosed in quotes) in an otherwise space-separated list of terms. Thus splitting the respective string by the space-character is not suffic
var str = 'foo bar "lorem ipsum" baz';
var results = str.match(/("[^"]+"|[^"\s]+)/g);
... returns the array you're looking for.
Note, however:
replace(/^"([^"]+)"$/,"$1") on the results.lorem and ipsum, they'll be in the result. You can fix this by running replace(/\s+/," ") on the results." after ipsum (i.e. an incorrectly-quoted phrase) you'll end up with: ['foo', 'bar', 'lorem', 'ipsum', 'baz']