You're almost there:

a[/(.*)_/, 1]

http://ruby-doc.org/core-2.0.0/String.html#method-i-5B-5D

-- 
Posted via http://www.ruby-forum.com/.