<p>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 sufficient anymore.</p>

<p>Example:</p>

<pre><code>input : 'foo bar "lorem ipsum" baz'
output: ['foo', 'bar', 'lorem ipsum', 'baz']
</code></pre>

<p>I wonder whether this could be achieved with a single RegEx, rather than performing complex parsing or split-and-rejoin operations.</p>

<p>Any help would be greatly appreciated!</p>

```
```
'foo bar "lorem ipsum" baz'.match(/"[^"]*"|\w+/g);
```
```
the bounding quotes get included though