From: gsterndale Date: 2008-07-23T15:49:24+09:00 Subject: Re: largest Regex match possible On Jul 23, 1:55 am, Heesob Park wrote: > Hi, > > 2008/7/23 gsterndale :> In the example below I'd like to match 'what is' and 'foo bar'. Any > > ideas? > > > 'what is foo bar' =~ /(.*)\s*(foo bar|bar)/ => 0 > > $1 => "what is foo " > > $2 => "bar" > > > Thanks! > > Try this: > > 'what is foo bar' =~ /(.*?)\s+(foo bar|bar)/ > > Regards, > > Park Heesob Good stuff. Thanks Park!