From: Bill Kelly Date: 2001-11-23T15:38:08+09:00 Subject: [ruby-talk:26199] Re: regex/split/scan question (was: Re: Linux Magazine article) From: "Jos Backus" > [...] > ext = mbox.scan(/-(.+)/)[0] > > sort of works but returns an Array; > > ext = mbox.scan(/-(.+)/)[0][0] > ext = mbox.scan(/-(.+)/).pop.pop > > works only when the scan matches, but throws a NameError on nil otherwise. ext = mbox.scan(/-(.+)/).flatten[0] ? :-) Regards, Bill