What regexp can split a string to argv

Hi
I want to split a string to a array like shell doing. And the
double qote string must be support.
For example
'1 2 " 3 4 5" 6 ’ => [‘1’, ‘2’, ‘2 4 5’, ‘6’]
‘1 2 7"3 4 5"6’ => [‘1’, ‘2’, ‘72 4 56’]
Can regexp do this ?
Or any other way?

haomiao wrote:

http://www.ruby-doc.org/core/classes/Shellwords.html