From: Kendall Gifford Date: 2011-07-23T03:50:51+09:00 Subject: Re: regex oddity --000e0cd571f2ad644804a8acf1bb Content-Type: text/plain; charset=UTF-8 On Fri, Jul 22, 2011 at 12:41 PM, Roger Pack wrote: > Anybody know why this occurs? > > >> 'a'.scan /.*/ > => ["a", ""] > > Is this normal/expected? > Not saying this is normal, but my suspicion is: #scan first matches "a" (whole string), then tries to match on remainder ("") and matches (since '*' matches 0 character) giving you another match of "". This behavior seems buggy IMHO. I'd think #scan would stop after the whole string was consumed. However, I do like that "".scan /.*/ => [""] -- Kendall Gifford zettabyte@gmail.com --000e0cd571f2ad644804a8acf1bb--