On 19 Mrz., 10:09, Xavier Noria <f... / hashref.com> wrote:

> My interpretation of what you need is:
>
>     input = '111|"aaaa" bbbbb|c'
>
>     fields = input.split('|')
>     fields[1].gsub!('"', '""')
>     fields[1] = %Q{"#{fields[1]}"}
>
>     output = fields.join('|')
>
> Depending on the input that may not be valid, for example if fields[1]
> may contain a pipe. Anyway being a mal-formed input assumptions depend
> on the actual data.
>
> -- fxn


your solution works, and thanks for that,
I am waiting though for a regexp solution,

thanks anyway
chris