JSFiddle - React, Tailwind, and code Playground

HTML

<div id="path">\this\is\the\path</div>
<div id="new-path"></div>

JavaScript

var e = $("#path").text();
e = e.replace(/\\/g, "|");
$("#new-path").append(e);