From: Simon Strandgaard Date: 2004-10-01T06:29:10+09:00 Subject: Re: Regexp question On Thursday 30 September 2004 23:15, Mark Probert wrote: > Hi, Rubyists. > > What is the best way of attacking field split on ';' when the string looks > like: > > s = 'a;b;c\;;d;' > s.split(/???;/) > => ["a", "b", "c\;", "d"] > > Or is it best to use s.each_byte and do it by hand? How about something ala irb(main):015:0> "aa;bbb\\;;abc;;d\\\\;e;".scan(/(?:\\[^.]|[^;])*;/) => ["aa;", "bbb\\;;", "abc;", ";", "d\\\\;", "e;"] -- Simon Strandgaard