From: "Ara.T.Howard" Date: 2005-10-30T00:59:32+09:00 Subject: Re: csv.rb a start on refactoring. On Sun, 30 Oct 2005, James Edward Gray II wrote: > On Oct 28, 2005, at 9:47 PM, James Edward Gray II wrote: > >> On Oct 28, 2005, at 8:43 PM, Ara.T.Howard wrote: >> >>> yeah i know.. but this seems completely equivalent, though it might >>> perhaps >>> also need anchoring.... >>> >>> buf.scan(%r/ ^ ... /) do |cell| >>> >>> end >>> >> >> Only if \G is the first character in the expression. ;) > > Uh, that didn't make any sense. \G must be the first thing matched by the > expression, obviously. > > The reason scan() alone doesn't replace \G is that it will skip characters, > if needed, to find a match. \G anchors the expression to prevent that very > behavior. > > Hopefully, that makes more sense. you are right of course. the strscan library has the behaviour i was thinking of... it might be a place to look to... the only issue i really saw with that uber re was that it didn't handle leading and trailing spaces correctly : they weren't stripped... have you checked the speed on a large file yet? -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | anything that contradicts experience and logic should be abandoned. | -- h.h. the 14th dalai lama ===============================================================================