From: Gavin Kistner Date: 2006-11-01T07:22:47+09:00 Subject: Re: regex capture and assign... in one line? From: Nate Murray [mailto:jashmenn@gmail.com] > $str = "foo123"; > > my ($foo,$bar) = $str =~ /(\w+)(\d+)/; irb(main):001:0> str = "foo123" => "foo123" irb(main):004:0> _,foo,bar = /(\w+)(\d+)/.match( str ).to_a => ["foo123", "foo12", "3"] Perhaps you meant ([a-z]+), but that's obviously not the point.