From: 7stud -- Date: 2011-03-05T06:32:32+09:00 Subject: Re: printing regex results Because you are interested in getting the whole match, create a group for it: str = "abcABC" arr = str.scan /((..).)/ p arr arr.each do |sub_arr| puts sub_arr[0] end --output:-- [["abc", "ab"], ["ABC", "AB"]] abc ABC Note that your backreference then becomes \2 rather than \1. -- Posted via http://www.ruby-forum.com/.