On Sun, 2005-07-10 at 00:47 +0900, Jim Weirich wrote: > Will this work? (I used + instead of space as in your example) > > str = "bla.h+aoeu.++test.\n+.hello" > p str.gsub(/\.\+|\+\.|\./) { |s| > case s > when '+.' then '.' > when '.+' then '+' > else "\n" > end > } > ==> "bla\nh+aoeu++test\n\n.hello" Hey that's cool, I didn't know you could do that. I think i'll stick with my queue solution though. The thing i failed to mention is that i want to tokenize across spaces not preceded or followed by a dot. I'm also forming it into a tree structure at the same time.... Thanks for the gsub tip though! -- Luke Worth