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?
> 

Normally this would call for fixed width lookbehind,

/(?<!\\);/

but as far as I know its not included in the ruby regexp engine.

But for further clarification:
How should 'a;b\\;;c' be split?
If backslashs can be escaped (and you'd want that because otherwise you 
can't have a field "b\" its more difficult.

And maybe the CSV library can help you here.

regards,

Brian

-- 
Brian Schr?der
http://ruby.brian-schroeder.de/