From: Matthias Luedtke Date: 2006-09-29T20:16:25+09:00 Subject: Re: Regexp help > I have a string of the form [...] > > Is there a smart regexp one liner that could produce Hello Marcus, here's my take on it: times = %w{ 2hour3min 2h3minutes 3m2h 2h3m } => ["2hour3min", "2h3minutes", "3m2h", "2h3m"] times.map{ |t| [t[/\d+h(a-z)*/].to_i, t[/\d+m(a-z)*/].to_i] } => [[2, 3], [2, 3], [2, 3], [2, 3]] Probably a little slower than the other solutions but perhaps easier to grasp. Regards Matthias