From: "James F. Hranicky" Date: 2003-08-21T04:03:49+09:00 Subject: Re: What attracts me to Ruby On Thu, 21 Aug 2003 03:37:20 +0900 Dan Doel wrote: > For example: > > re = /(.)(.)((.).)/ > match = re.match "abcd" > > if match > p match[0] > p match[1] > p match[2] > p match[3] > p match[4] > end As of 1.8, MatchData has the captures method as well: % ruby -e 'p "abcd".match(/(.)(.)(.)(.)/).captures' ["a", "b", "c", "d"] % ruby -e 'a, b, c, d = "abcd".match(/(.)(.)(.)(.)/).captures; puts a, b, c, d' a b c d ---------------------------------------------------------------------- | Jim Hranicky, Senior SysAdmin UF/CISE Department | | E314D CSE Building Phone (352) 392-1499 | | jfh@cise.ufl.edu http://www.cise.ufl.edu/~jfh | ---------------------------------------------------------------------- About politics: Don't worry about results It's the thought that counts