Perl 5, 44 (code) + 1 (-p
) = 45, 44 bytes
1while s,(/)\|(?!\\)|(?<!/)\|(\\),$1$1$2$2,g
Explanation
1while s, , ,g while anything found substitute globally
(/)\|(?!\\) $1$1 /| that is not followed by \ to //
| or
(?<!/)\|(\\) $2$2 |\ that is not preceded by / to \\