On Sunday, October 12, 2003, 1:50:16 PM, Mike wrote: > I have a line of text output in columnar form; what's the best way to split it > into its requisite parts? > Say I have lines of > aaaaabbcccccddeee > I can do something like: > md = /(.....)(..)(.....)(..)(...)/.match(line); # seems klugy somehow I'm not sure what you mean by columns, given your example. Columns, to me, suggests columns in a newspaper. But in your example, there's not much wrong with what you've done. A slight improvement is data = /(.{5})(.{2})(.{5})(.{2})(.{3})/.match(line).captures The reason I suggest this is that you can easily generalise it (replace the literal numbers by variables) to accept different column widths. However, I suspect you had something more complicated in mind. Gavin