From: bwv549 Date: 2007-07-24T06:25:03+09:00 Subject: Re: finding positions in a string Well, here's what I have so far: def substring_positions(substring, string) substring_len = substring.size s = StringScanner.new(string) regexp = Regexp.new(Regexp.escape(substring)) positions = [] while s.scan_until(regexp) positions << (s.pos - substring_len) end positions end In theory, it looks fairly fast, but it's not all that concise... Anyone have anything better? Thanks