What regexp can split a string to argv


#1

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?


#2

haomiao wrote:

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