Not perfect, but something you could start with:

result = cmd[ /\A(astro|core|fm_shell|formality|gca_shell|xa)\z/i, 1 ]

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