From: Heesob Park Date: 2008-07-23T14:55:52+09:00 Subject: Re: largest Regex match possible 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