From: MikkelFJ Date: 2003-03-12T04:51:50+09:00 Subject: scanning strings I want to scan a string for breaks. I want to pick both the breaks and the text in between. If I use String#each I loose the space. If I use String#scan, I get into a fairly involved expression with two submatches where the second submatch is almost exactly the negation of the first submatch. Is it it possible to break a string such that you get a both the match and the text before last match, if any? If not, wouldn't that be a useful feature in Ruby? One simple example is processing a line at a time, but you want to keep the break style of the source text which could be , or . Mikkel