huseyin polat wrote:

> now I want to print this string as
> [1,2],[2,1],[3,1],[4,1]
> in other word I want to add comma between those ][ and make them look 
> like ],[
> I tried gsub with hundred different possibilities but no luck,

no need of regexps nor gsub:

str.split("][").join("],[") #=> "[1,2],[2,1],[3,1],[4,1]"

Ciao!
Marco

--
This way, to star trek...

-- 
Posted via http://www.ruby-forum.com/.