On 2-Mar-06, at 7:28 PM, Tim Hunter wrote:

> huseyin polat wrote:
>> thank for post, but didn't change anything. maybe I should post my  
>> entire program.
>> anybody wants to post their email to take a look at the program ?
>> one more thing, I get the string from a value [1,2][2,1][3,1][4,1]  
>> that is originally created by push an array and then copied into  
>> my hash
>> bighash.sort.each{|key,value|
>>    value.each{ |value|
>>     str=String.new
>>     value=value.to_s
>>     str=value
>>   print str.split("][").join("],[")
>>   }
>
> Here's the output I get when I try Marco's solution. It looks right  
> to me.
>
> iptc$ irb
> irb(main):001:0> str="[1,2][2,1][3,1][4,1]"
> => "[1,2][2,1][3,1][4,1]"
> irb(main):002:0> puts str.split("][").join("],[")
> [1,2],[2,1],[3,1],[4,1]
> => nil
> irb(main):003:0>
>
>

irb(main):001:0> "[1,2][2,1][3,1][4,1]".gsub(/\]\[/, '],[')
=> "[1,2],[2,1],[3,1],[4,1]"

-- 

Mike Stok <mike / stok.ca>
http://www.stok.ca/~mike/

The "`Stok' disclaimers" apply.