From: Bil Kleb Date: 2006-10-11T22:45:11+09:00 Subject: Re: scanning strings, backward? Vidar Hokstad wrote: > Bil Kleb wrote: >> 1) Goto line 1707 of the file >> 2) Search backward until line.match /\Wdt\W/i >> 3) Remove /dt/i > > For 2) Any particular reason why you need to search backwards? My > suggestion would be to look at String#gsub - that will help you handle > both 2) and 3) in one go. The problem is I only want to replace only the first occurrence before line 1707. But, by reversing the lines per Ed B's suggestion, I should be able to use String#sub on a temporary buffer, and glue things back together for the next item / line number combination? (not sounding terribly elegant) Later, -- Bil Kleb http://fun3d.larc.nasa.gov