News for hackers. Stuff that matters.
Re:New Ruby 1.9 Features, Tips & Tricks by igrigorik on Monday February 21, 2011 @03:43PM (#2247084)
Speaking of named captures.. Something I didn't mention in the blog post, but a rather handy feature:

ruby-1.9.2-p136 :011 > /My name is (?<first>\w+) (?<last>\w+)/ =~ "My name is Ilya Grigorik"

ruby-1.9.2-p136 :012 > first

"Ilya"

ruby-1.9.2-p136 :013 > last

"Grigorik"

There are no comments on this comment yet.