On Fri, Oct 7, 2011 at 1:59 PM, skolo pen <skolopen / yahoo.com> 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"]