From: David Alan Black Date: 2002-02-13T21:01:17+09:00 Subject: Re: simple XML parsing (greedy / non-greedy Hi -- On Wed, 13 Feb 2002, Ron Jeffries wrote: > Suppose I had this text > > 'this is athis is a also' > > and I wanted to write a regexp that would match the tag .. and > return > > 'this is a' > (not 'this is athis is a also') > > I'd sort of like to use a pattern like > > Regexp.new( '(.*)' ), but this is greedy and matches as far as it > can. > > Is there a way to tell the match operator to stop on the earliest match? Yes -- just use *? instead of * David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav