From: Ken Collins Date: 2006-10-04T21:41:18+09:00 Subject: Re: Using a Regexp to find a Hash Key? I sent an new one out right after this. It appears that my public email key being attached to the email was wiping the body for some reason. - Ken (to reply again) I sure could... The hash is going to be real small. It would at most only have 3 or 4 keys. The one I want has a prefix of an arbitrary string with any amount of number after it. I need to know if this key is present so that I can run a conditional block of code. It would be a bonus to get some match data back on that last series of digits in the regexp. I would like to use something like this: def foobar if hash.has_key?(/^foo_\d+$/) ... end end Meanwhile my code looks like this and I was pretty sure there might be a more terse solution. def foobar unless params.reject{ |k, v| k !~ /^foo_\d+$/ }.empty? ... end end On Oct 4, 2006, at 8:38 AM, Paul Battley wrote: > On 04/10/06, Ken Collins wrote: >> >> >> > > Very postmodern! > > (Does anyone get any body text in Ken's emails? I'm receiving just the > headers - and it looks like I'm not alone, judging by Paul Lutus's > earlier message.) > > Paul. >