hello !

i have a problem with ruby's gsub function:

i want to substitute one \ with two \\

in irb this looks as follows:

> x = '/\\'
"/\\"
> puts x
/\
nil
>    # this works
> puts x.gsub(/\\/,'a')
/a
nil
>    # the following is the problem:
> puts x.gsub(/\\/,'\\\\')
/\
nil
>    # why not /\\ ?
> puts x.gsub(/\\/,'a').gsub(/a/,'\\\\')
/\
nil
>    # why not /\\ ?
> puts x.gsub(/\\/,'\\\\\\')
/\\
nil
>    # why ????


thanks in advance,

peter