# [Perl 5], 44 (code) + 1 (`-p`) = 45 bytes

<!-- language-all: lang-perl -->

    1while s,(/)\|(?!\\)|(?<!/)\|(\\),$1$1$2$2,g

[Try it online!][TIO-jc28u92p]

[Perl 5]: https://www.perl.org/
[TIO-jc28u92p]: https://tio.run/##K0gtyjH9/9@wPCMzJ1WhWEdDXzOmRsNeMSZGE0jZKIK5QI6OiiEQGqkY6aT//19TU6MPxDVcQBwDYYD5MSARfRgjBqzsX35BSWZ@XvF/3QIA "Perl 5 – Try It Online"