I have the following code:
document.getElementById("rep").innerHTML = document.getElementById("rep").innerHTML.replace(rxp, "abc");
<div id="rep"> asd 123 asd <span class="light">123</span> asd 123 asd <span class="light">123</span> </div>
Here, rxp is a regular expression which matches the numbers.
Problem is that I want to replace only those 123 that are not enclosed in span and not to replace 123 which enclosed in <span class="light">.