From: Florian Gross Date: 2005-02-10T09:05:07+09:00 Subject: Re: How to mimic Perl's `s///' in Ruby? Assaph Mehr wrote: >>raise "String error: #{str}" unless /^(\d+)\s+(.*)$/ =~ str >>pid, name = $1, $2 > > One thing I've wondered about: is this thread safe? Is there a chance > that between the first and second statements something will change the > result of the global variables? They are thread-global variables. The same applies for $_. I still prefer this form for complex matches, though: if md = re.match(str) then capture1, capture2 = md.captures ... end