From: MonkeeSage Date: 2006-09-29T18:15:07+09:00 Subject: Re: Regexp help Marcus Bristav wrote: > Is there a smart regexp one liner that could produce > > [2, 3] r = Regexp.new(/(\d+)h.*(\d+)m/) s1 = "2h 3m" s2 = "2h 3minutes" s3 = "2hour 3min" m = r.match(s1) p [m[1].to_i, m[2].to_i] # => [2, 3] m = r.match(s2) p [m[1].to_i, m[2].to_i] # => [2, 3] m = r.match(s3) p [m[1].to_i, m[2].to_i] # => [2, 3] Regards, Jordan