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

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

    s,(/)\|(?!\\)|(?<!/)\|(\\),$+$+,g&&redo

[Try it online!][TIO-jc2c41xq]

[Perl 5]: https://www.perl.org/
[TIO-jc2c41xq]: https://tio.run/##K0gtyjH9/79YR0NfM6ZGw14xJkYTSNkogrlAjo6Ktoq2TrqaWlFqSv7//zU1NfpAXMMFxDEQBpgfAxLRhzFiwMr@5ReUZObnFf/XLQAA "Perl 5 – Try It Online"
<!-- language-all: lang-perl -->

### Explanation

    s,                                         substitute
      (/)\|(?!\\)                              /| that is not followed by \ capturing /
                 |                             or
                  (?<!/)\|(\\)                 |\ that is not preceded by / capturing \
                              ,$+$+,g          to what was captured repeated twice, globally
                                     &&redo    if matched then redo