>     str = 'hi hello  "hello world" hey yo'
>     p str.scan(/(".*")|(\w+)/).flatten.compact
> 
>  => ["hi", "hello", "hello world", "hey", "yo"]
> 
> Greedy matching to the rescue!

Also, non-capturing groups help us remove the .flatten.compact nonsense:

     p str.scan(/(?:".*")|(?:\w+)/)

  => ["hi", "hello", "\"hello world\"", "hey", "yo"]

I'm not sure why one version capture the "" marks and the other did not...