Hi --

On Thu, 13 Jul 2006, Daniel Schierbeck wrote:

> My problem is that I have a string like this: "3:foo6:monkey5:sheep", which I 
> need to separate into ["foo", "monkey", "sheep"]. The values can contain 
> numeric values, so splitting at \d won't work. This is what makes it 
> difficult:
>
>  "3:ab23:cat5:sheep" => ["ab2", "cat", "sheep"]
>
> I need to grab the number, then read that many characters, then read the next 
> number, etc.

How do you know, in the case of:

   2:ab23:cat

which of the two is invalid?


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
http://www.manning.com/black     => RUBY FOR RAILS, the Ruby book for
                                                     Rails developers
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
dblack / wobblini.net              => me