From: Kyle Schmitt Date: 2009-03-05T11:44:47+09:00 Subject: Re: Cut a string each 80 character On Wed, Mar 4, 2009 at 8:06 PM, Guillaume Loader wrote: > Ooops! > Replace "each" by "every" > > Sorry! > - Show quoted text - > -- > Posted via http://www.ruby-forum.com/. > > I'm thinking you want scan. string.scan(/.{8}/) You may need to adjust the regex a little, but that should match 8 charicters at a time... I think if the length isn't a multiple of 8 it may just ignore the last bunch of chars... but you get the idea edit the regex as needed. PS: Scan is _awesome_ when you need to do some quick an dirty log analysis data=File.read(foo).scan(regex)