On Thursday 30 September 2004 23:40, Dany Cayouette wrote: > Any advice/ideas on the best way of attacking field split on ';' when the > string looks like: > > s = 'a;b;c\;;d;' > > i.e. field delimiter is ';', and if ; appears in field data ; => \; > > Any regex magic? or should I use s.each_byte and do it by hand? > hmmm.. your mail looks exactly like a mail I have replied to 2 minutes ago. http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/114414 something like this irb(main):023:0> "aa;bbb\\;;abc;;d\\\\;e;f".scan(/(?:\A|;)((?:\\[^.]|[^;])*)/) { p $1 } "aa" "bbb\\;" "abc" "" "d\\\\" "e" "f" => "aa;bbb\\;;abc;;d\\\\;e;f" irb(main):024:0> btw: are you solving some kind of exercise ? -- Simon Strandgaard