my_result_array =
my_hash.each_value do |my_array|
my_result_array += my_array.select { |item| item =~ /^[A-Za-z]+$/ }
end
The code above would go through and put all of the strings that only
consisted of letters into one array. Is something like this what you
were looking for?
p-hawk wrote:
···
Sorry for the simple question, but I'm new to programming and have been
banging my head over this.I've got myself a hash with each value an array of strings. I want to
grep the strings and collect only the strings that match the regexp
into an array. How do I go about this?