I have some HTML represented as a string.
ex:
var testHTMLString = "<div class='a'>test content</div>"
I want to be able to use regex and split this HTML string by its tags and wrap the broken up tag pieces with <span class='red'> and </span> in order to highlight pieces of the HTML string
expected result:
<span class='red'>"<div class='a'>"</span>test content<span class='red'>"</div>"</span>
I can't seem to get the regex correct in my program but in regex testers it seems to work
testHTMLString.split("/<(\/)?div.*?>/g"); is not splitting my HTML string into the pieces I want --> "<div class='a'>" and "</div>"
 
     
     
    