From: Josh Cheek Date: 2011-10-08T10:22:33+09:00 Subject: Re: regex an array? --bcaec501673f50756804aebf64ad Content-Type: text/plain; charset=ISO-8859-1 On Fri, Oct 7, 2011 at 1:59 PM, skolo pen wrote: > I am having troubles trying to regex the following array to only include > the last word > > ["user created TI: TI-0001"] > > I am trying to regex or gsub so only TI-0001 returns. > > -- > Posted via http://www.ruby-forum.com/. > > This could change depending on what constitutes valid data, but it solves the example you've given. array = ["user created TI: TI-0001"] array.map { |line| line[/\S+$/] } # => ["TI-0001"] --bcaec501673f50756804aebf64ad--