From: Ken Collins Date: 2006-10-05T09:04:29+09:00 Subject: Re: Using a Regexp to find a Hash Key? Actually, that was very good advice, THANK YOU! I did not even consider using an Enumerable method, I was stuck on Hash methods. if foo_key = hash.find { |k,v| k =~ /^foo_(\d+)$/ }[0] # Now I can use foo_key to look at the values # I can also use $1 where needed for the match end Thanks again, Ken On Oct 4, 2006, at 9:25 AM, MonkeeSage wrote: > MonkeeSage wrote: >> How about: > > Actually, make that #find rather than #select, so that iteration stops > as soon as the match goes through. > > Regards, > Jordan > >