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:

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?

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

···

--
RMagick OS X Installer [http://rubyforge.org/projects/rmagick/\]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?forum_id=1618\]
RMagick Installation FAQ [http://rmagick.rubyforge.org/install-faq.html\]