[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

what regexp can split a string to argv

haomiao

7/25/2007 10:56:00 PM

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?

1 Answer

Tim Hunter

7/25/2007 11:06:00 PM

0

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/Shell...

--
RMagick OS X Installer [http://rubyforge.org/project...]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?for...]
RMagick Installation FAQ [http://rmagick.rubyforge.org/instal...]