On Oct 25, 2005, at 2:32 PM, Michael Zanis wrote:

> Hi,
>
> I am new to ruby but have an okay background in perl.  I am trying  
> to parse
> a string into an array.
>
> string = (foo:0.05,bar:0.115);
>
> I would like the array to look like this:
>
> Array[0] = (
> Array[1] = foo
> Array[2] = 0.05
> Array[3] = ,
> Array[4] = bar
> Array[5] = 0.115
> Array[6] = )
> Array[7] = ;

See if this helps:

 >> "(foo:0.05,bar:0.115);".scan(/[a-z]+|\d+\.\d+|[(,);]/)
=> ["(", "foo", "0.05", ",", "bar", "0.115", ")", ";"]

James Edward Gray II