From: 7stud -- Date: 2011-03-05T06:15:51+09:00 Subject: Re: printing regex results scan() returns an array of full matches--unless you have groups in your regex. In that case, scan() returns an array where each element is itself an array, and each sub array contains the matches to the groups in your regex. Here is a simple example: str = "abcABC" arr = str.scan /(..)(.)/ p arr --output:-- [["ab", "c"], ["AB", "C"]] scan() found two matches for the regex, so their are two sub arrays. Each of the sub arrays contains the matches for the groups in the regex. Note that if parts of your regex are not part of a group, then they will not appear in the sub arrays: str = "abcABC" arr = str.scan /(..)./ p arr --output:-- [["ab"], ["AB"]] That is what you are seeing in your code. -- Posted via http://www.ruby-forum.com/.