From: martindemello@... (Martin DeMello) Date: 2001-12-20T07:28:20+09:00 Subject: [ruby-talk:29019] Re: Scanning for delimited substrings "Bill Kelly" wrote in message > > Sorry. (That's what I get for writing a one-liner without any > unit tests:) :) I took the excuse to pore over the extended regexp documentation and play with the features until I understood them properly. This seems to be the simplest way to do it: m = "#{Regexp.quote(l)}.*?#{Regexp.quote(r)}" s.scan(/#{m}|(?:.(?!#{m}))*./m) Though I just discovered the even simpler (but undocumented!) s.split(/(#{m})/) Still, all in all the regexp workout was well worth the effort - thanks for the help! -- Martin DeMello