From: Gennady Date: 2004-06-11T01:49:29+09:00 Subject: String#scan strangeness Hi there, [linux.gfbs:281]gfb> ruby -v ruby 1.6.8 (2003-10-15) [i686-linux] [linux.gfbs:282]gfb> irb irb(main):001:0> a = "a b c d " => "a b c d " irb(main):002:0> a.scan %r{((\S+\s+){2,2})} => [["a b ", "b "], ["c d ", "d "]] irb(main):003:0> I am just wondering why String#scan "looses" a group in every match. I would expect the following result: => [["a b ", "a ", "b "], ["c d ", "c ", "d "]] or even => [["a b ", ["a ", "b "]], ["c d ", ["c ", "d "]]] Where am I wrong in my expectations? Thank you, Gennady. P.S. It works the same way in Ruby 1.8.0 as well.