From: Ben Thomas Date: 2003-03-12T08:51:13+09:00 Subject: a newbie question Hi, I am trying to create an array from another array using a regular expression to compare them. If an element match the regular expression, then I want it to appears in my new array, otherwise it can be discarded. I have come up with the following code (for example, getting strings than end in 'abba' in an array of string) new_array = (array.collect { |x| if( x =~ /abba$/ ) then x else nil end }).compact It works fine, but I want to know if there's is a more simple way to do this since I do this a lot in my scripts. Thankx, Ben.