From: Eric Hodel Date: 2009-08-27T03:50:48+09:00 Subject: Re: find string, get line number or position, then restart at +1 On Aug 26, 2009, at 08:44, Derek Smith wrote: > Ok so I have a file where I am searching for the string "Jul 14.*" for > example using a regexp and this is working fine. However I have been > debating on how to move forward with what code, $. or tell with seek? If it's a small file, use StringScanner: require 'strscan' text = File.read the_file scanner = StringScanner.new text scanner.scan /Jul 14/ # ... ri StringScanner for details.