From: Olivier Lance Date: 2011-08-30T01:32:54+09:00 Subject: Re: String#split resets regex captures variables (Ruby 1.8.7) > I am doing the opposite experience over at c.l.scheme - zero replies. > So you're lucky to be on this side of the fence. Well good luck then ^^ > Depends on the number of groups. If I want to be sure values are not > changed I typically do something like > > if /../ =~ str > name = $1 > age = $2.to_i > ... > # use name and age > end > > Or, if there are many groups you could do > > if /../ =~ str > all, name, age, more, variables, here = *$~ > ... > # use name, age, more, variables, here > end All right, that's more or less what I've done, I'll improve on that :) Thanks again to everybody! -- Posted via http://www.ruby-forum.com/.