From: Rick DeNatale Date: 2008-05-05T09:48:28+09:00 Subject: Re: Backreferences in case statements On Sun, May 4, 2008 at 11:22 AM, David A. Black wrote: > > > 2008/5/3 : > > > > Where does Ruby store the MatchData if the > > > > matching is done in a case statement? > > Matching doesn't change in or out of a case statement; it's still the > same thing. > Ruby keeps track of the last match operation performed, and that's > what you get in $~ (which is a MatchData object) and some of the > Regexp class methods. And $~ is actually a thread local global, so it holds the matchdata produced by the last successful match on the current thread. I'm pretty sure that Regexp.last_match is thread-safe as well. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/