I have a small piece of text:
"some text" some more text "even more text"
What I wanna do is to wrap everything between apostrophes in a span container just like hilight.js does. I can't really find a way to make it working.
Could somebody please explain me what would be the ideal way to do this?
var body = document.querySelector('body');
var code = body.innerHTML;
var code = code.replace(/"(.*?)"/g,"<span>---</span>");
body.innerHTML = code;
span {
color: red;
}
<body>
<p>Corrent result:</p>
"some text" some more text "even more text"
<p>The result would be:</p>
<p><span>some text</span> some more text <span>even more text</span></p>
</body>