From: Tanaka Akira Date: 2004-03-25T12:29:50+09:00 Subject: Re: GString and XSS (Re: groovy) In article <87hdweuzit.fsf@serein.a02.aist.go.jp>, Tanaka Akira writes: >> str.gsub!(/(\s\w)(\w+)(\w\s)/) do |m| >> m[3] + m[2] + m[1] >> end > > I think a regexp with named capture should binds local variables. > It makes possible to describe your example as follows. > > str.gsub!(/(?\s\w)(?\w+)(?\w\s)/) { a + b + c } Oops. It should be: str.gsub!(/(?\s\w)(?\w+)(?\w\s)/) { c + b + a } -- Tanaka Akira