From: David Alan Black Date: 2002-07-06T07:39:57+09:00 Subject: Re: Regular Expression problems Hi -- On Thu, 4 Jul 2002 nobu.nokada@softhome.net wrote: > Hi, > > At Thu, 4 Jul 2002 02:25:01 +0900, > Jonas Bengtsson wrote: > > So the problem is that the second group--(.*)--is too 'hungry' and > > doesn't stop on the first occurrence of the third group--( > > > Is it possible to change this behavior of the second group? Or are > > there any better ways to solve this problem? > > re = /\n(.*?)( > Or: > re = /\n(.*?)(?= while match = re.match(unprocessed) > name = match[1] > content = match[2] > unprocessed = match.post_match # <-- > puts "MATCH", "name:#{name}", "content:#{content}" > end One more variant, using the mighty #scan: re = /\n(.*?)(?=